Password-less SSH Login: Difference between revisions

From D3xt3r01.tk
Jump to navigationJump to search
m 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 …'
 
mNo edit summary
Line 5: Line 5:
==HOW==
==HOW==


This is the LOCAL HOST setup
<source lang="bash">
<source lang="bash">
#this is the LOCAL HOST setup
ssh-keygen -t rsa -b 1024 -f ~/.ssh/rsync-key
ssh-keygen -t rsa -b 1024 -f ~/.ssh/rsync-key
</source>
</source>


This is the REMOTE HOST setup. Get the rsync-key.pub from the LOCAL HOST through some secure way on the REMOTE HOST
<source lang="bash">
<source lang="bash">
#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
cat ~/.ssh/rsync-key.pub >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh/authorized_keys
chmod 700 ~/.ssh/authorized_keys
</source>
</source>


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


Use this to login:
Use this to login from your LOCAL HOST:


<source lang="bash">
<source lang="bash">

Revision as of 13:58, 30 December 2010

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 on your REMOTE HOST.

Use this to login from your LOCAL HOST:

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

Enjoy.