Operating System - HP-UX
1834717 Members
2411 Online
110069 Solutions
New Discussion

Is there a option to provide the password in ssh command?

 
SOLVED
Go to solution
Hanry Zhou
Super Advisor

Is there a option to provide the password in ssh command?

I want to to ssh to a host and within the same command line, I want to also provide the password,thus, not waiting for the ssh comimg back the password prompt.

Is there such option?
none
5 REPLIES 5
Mark Grant
Honored Contributor

Re: Is there a option to provide the password in ssh command?

You can get ssh to not ask for a password instead, will that do?

You need to generate a key and copy that to the machine you want passwordless logins to. After that, you are fine. Have a look at the "ssh-keygen" man page.
Never preceed any demonstration with anything more predictive than "watch this"
RAC_1
Honored Contributor
Solution

Re: Is there a option to provide the password in ssh command?

Absolutely not. That defeats the whole purpose of using ssh.

SSH can be set to authnticate in three ways.

1. host based (Use of /etc/shosts.equiv and .shost files)
2. PAssword based.
3. Exchane of private and public keys.
(Keys are generated and public keys are put in taget hosts-user's authorized_keys file. This does not requuire any interactive steps when loggin in.)
man ssh-keygen for that.

Anil
There is no substitute to HARDWORK
Hanry Zhou
Super Advisor

Re: Is there a option to provide the password in ssh command?

I know I can ssh to the remote withought entering password by transfering the public key over, but can't I supply the password in the ssh command line? like:
ssh -l user remote_host -optiont password?
none
Mark Grant
Honored Contributor

Re: Is there a option to provide the password in ssh command?

as soon as you do that, you have provided an unencrypted password that can be obtained by naughty people. Just by typing that command at your terminal you put yourself at risk (even before you press ENTER).

Therefore it doesn't make sense for "ssh" to allow it.
Never preceed any demonstration with anything more predictive than "watch this"
Steven E. Protter
Exalted Contributor

Re: Is there a option to provide the password in ssh command?

I hope that openssh would not allow what you want to do.

It violates the very principle that the software was created to handle. secure shell. Putting the password and transmitting on the commandline completely defeats that purpose.

SEP
Jerusalem
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com