SSH Tutorial: Difference between revisions
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…' |
No edit summary |
||
Line 8: | Line 8: | ||
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'. | 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'. | ||
== Scope == | == Scope == | ||
Line 43: | Line 37: | ||
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. | 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. | ||
== 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 <span class="code">root</span> and then try to connect as <span class="code">someuser</span>, the key will not be used. You would need to create another key as <span class="code">someuser</span>. | |||
Likewise, where you put the public key on the destination server will define which user you can connect as on the remote machine. | |||
{{footer}} | {{footer}} |
Revision as of 18:30, 3 June 2010
Alteeve 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'.
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.
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.
Any questions, feedback, advice, complaints or meanderings are welcome. | |||
Alteeve's Niche! | Alteeve Enterprise Support | Community Support | |
© 2025 Alteeve. Intelligent Availability® is a registered trademark of Alteeve's Niche! Inc. 1997-2025 | |||
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. |