Password-less SSH Login

From D3xt3r01.tk
Revision as of 13:56, 30 December 2010 by Admin (talk | contribs) (Created page with '==WHY== Because you might want that some of your scripts to be able to login to a remote host and do stuff without storing your password... ==HOW== <source lang="bash"> #this …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

WHY

Because you might want that some of your scripts to be able to login to a remote host and do stuff without storing your password...

HOW

#this is the LOCAL HOST setup
ssh-keygen -t rsa -b 1024 -f ~/.ssh/rsync-key
#this is the REMOTE HOST setup
#get the rsync-key.pub from the LOCAL HOST through some secure way on the REMOTE HOST
cat ~/.ssh/rsync-key.pub >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh/authorized_keys

Be sure to enable public-key login in your sshd_config.

Use this to login:

ssh -i ~/.ssh/rsync-key -oPort=5522 user@remote_host -v

Enjoy.