Published December 17th, 2007 by admin
This guide assumes that you have an SSH server setup on your “server” and an SSH client set up on your client. (sudo apt-get install openssh-server & sudo apt-get install openssh-client respectively)
First from the client run the following command logged in as your normal user account:
(Leave the password blank if you do not want to supply it on login, but remember to guard the created cert with your life as it opens the door to anyone that finds it…)
This creates id_rsa and id_rsa.pub in the ~/.ssh directory.
Next we want to upload the pub file to the remote server/host that you want to connect to:
scp ~/.ssh/id_rsa.pub remoteuser@remotehost:~/
Now that it is uploaded we have to authorize it by connecting to the remote machine (ssh user@remotehost) and running the following on the remote host:
cat id_rsa.pub >> ~/.ssh/authorized_keys
to delete the uploaded file.
If the remote host does not have key authentication enabled (should be by default), ssh the machine and edit the config file like such:
and add/change the following to options as such:
then reload the config:
At this point you can check to make sure that you are allowed to log in via your key and if that is the case you can disable password authentication.
Edit the config again:
and set the following:
reload the config:
That it. You are now on your way to more secure/hassle free SSH authentication.