SSH Tutorial

From Alteeve Wiki
Revision as of 18:29, 3 June 2010 by Digimer (talk | contribs) (Created page with '{{howto_header}} '''Note''': This needs work. ---- = Password-less Inter-server Communication = This shows how to have the two servers accept each other's SSH keys without th…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

 AN!Wiki :: How To :: SSH Tutorial

Note: This needs work.


Password-less Inter-server Communication

This shows how to have the two servers accept each other's SSH keys without the need for passwords. This allows for, among other things, to shuffle data between two servers securely using 'rsync'.

A Note

Keys you generate will only work when connecting from the source computer as the user you created the key as. For example, if you create the key as root and then try to connect as someuser, the key will not be used. You would need to create another key as someuser.

Likewise, where you put the public key on the destination server will define which user you can connect as on the remote machine.

Scope

This is meant to be a dead-simple example of how to create a shared key to avoid the need for passwords. Nothing more. In the same vein, it is expected that you understand the potential security implications of doing so.

Source Machine and User

On the source machine, as the user you will make the ssh call as, run:

ssh-keygen -t rsa

Accept the default value for the prompts.

You should now see two new files; '~/.ssh/id_rsa' and '~/.ssh/id_rsa.pub'. Open the public key file:

cat ~/.ssh/id_rsa.pub

Copy the output and then ssh normally into the remote machine.

ssh someuser@somehost

Once you've logged in with the password, create/edit the the ~/.ssh/authorized_keys file and paste the contents of your ~/.ssh/id_rsa.pub file on a new line. Save the file and then log out of the remote host.

Done. You should now be able to reconnect exactly as you did a moment ago, but this time you will not be prompted for a password.

 

Any questions, feedback, advice, complaints or meanderings are welcome.
Alteeve's Niche! Enterprise Support:
Alteeve Support
Community Support
© Alteeve's Niche! Inc. 1997-2024   Anvil! "Intelligent Availability®" Platform
legal stuff: All info is provided "As-Is". Do not use anything here unless you are willing and able to take responsibility for your own actions.