|
|
View previous topic
::
View next topic
|
Author |
Message |
ramon fincken Site's programmer
 Get a free globally recognized avatar It's free!
Joined: 03 Aug 2007 Posts: 412 Location: A'dam/Diemen, The Netherlands
|
Posted: Mon May 14, 2012 9:06 am Post subject: SSH without password (using keys) |
|
|
This is a partial quote from http://www.linuxquestions.org/questions...rd-533684/ User: Brianetta
The way that does not require a password. You can use public/private key authentication instead of passwords with SSH. I'm going to assume that you're using OpenSSH, which comes with practically every Linux distribution that there is.
- Configure your SSH server to accept private key logins. In /etc/ssh/sshd_config make sure that there's a line that says PubkeyAuthentication yes (and that there is no # infront of it). If you change this file, you need to restart the sshd service. If you're not sure, stop and ask somebody here before you break it.
- On your local machine (not the server), create yourself a pair of keys with ssh-keygen -t rsa (you can use other options than rsa, but I'm keeping it simple). Do not specify a password. Save the keys in the locations prompted.
- Open the contents of the id_rsa.pub file that you just created (it's one very long line of text), and copy the contents into the end of the file $HOME/.ssh/authorized_keys on the server machine. Create the file if it doesn't exist.
Now you should be able to ssh user@remote.host without a password. If that works, you can use it in scripts, etc. Because you have a private key with no password to protect it, it's important that you make sure that nobody gets their grubby hands on your id_rsa file. They can have the id_rsa.pub file (it's public, you see) but the other one's your precious.
If you think somebody has a copy of your id_rsa file, you can delete the line that you added to authorized_keys on the server, to disable that key. |
|
Back to top |
|
 |
Google adsense Advertisement
|
Posted: Mon May 14, 2012 9:06 am Post subject: SSH without password (using keys) |
|
|
Advertisement
|
|
Back to top |
|
 |
GravityForms Advertisement
|
Posted: Mon May 14, 2012 9:06 am Post subject: SSH without password (using keys) |
|
|
Advertisement
 |
|
Back to top |
|
 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|