1846808 Members
3227 Online
110256 Solutions
New Discussion

Re: SSH

 
Vanquish
Occasional Advisor

SSH

Hi Everyone
i am using ssh to login to a remote machine.
ssh -l login host
is there any way i can put my password in same command line.
ssh -l login host ? password
Thanks
3 REPLIES 3
Geoff Wild
Honored Contributor

Re: SSH

You would have to use expect for that...

http://hpux.ee.ualberta.ca/hppd/hpux/Tcl/expect-5.41/

or setup shared keys....

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Steven E. Protter
Exalted Contributor

Re: SSH

You can setup password free ssh/scp/sftp login.

Procedure attached.

SEP
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
Sridhar Bhaskarla
Honored Contributor

Re: SSH

Hi,

YOu would need to setup public/private authentication with the remote server so you don't have to specify the password. It's simple. Do

$ssh-keygen -t dsa -N ""

sftp the id_dsa.pub file to the remote server (hostB) and put it in the destination home directory as authorized_keys .ssh directory there. If authorized_keys file already exists, then append this file to it. Once it is done then try

ssh hostB

It shouldn't prompt you for the password. This isn't a full secured mode of operation as you are not specifying a passphrase with -N. But it's better than your intention of giving your password in the command line.

SSH is strict in checking permissions. So, you will need to ensure the permissions on the home directory are atleast 755 and .ssh inside it are 600 on the destination system.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try