SSH without a password

Lets get the terminology straight. For the purposes of this discussion, we will call the machine you want to login to the “server”. The machine you are logging in from (without a password) is the “client”.
In order for this to work you must have an account on both machines. Be sure to work on the accounts that you will be loging in to and from respectively.
- On the client:
ssh-keygen -t dsa - hit “enter” to accept the default file location
- hit “enter” twice to proceed without a password
- Take note of where your public key was saved, then go there
- Copy the contents of id_dsa.pub
- On the server
cd ~/.ssh/ - Open the file called “authorized_keys” (create it if necessary)
- Paste the contents of id_dsa.pub into this file, then save the file
- Done! You should be able to login via ssh from the client to the server without a password
Gotchas and discussion:
- dsa seems to be a solid choice for encryption type, over for instance, rsa. However, I’m not an expert, so you should satisfy yourself as to the right choice
- The whole point of this is to avoid having to enter a password, so I don’t enter a password to protect my keys. Only do this if you feel confident that your private key will be safely under your control.
- I used “copy” and “paste” in my instructions to try to cater to the less experienced users. If you would rather do things like
cat id_dsa.pub >> ~/.ssh/authorized_keysthen go for it. - Make sure you don’t introduce return characters (line breaks) into authorized_keys by mistake. The whole key is supposed to be two lines, like this:
ssh-dss
AAAAB3NzaC1kc3MA ..............(lots more)