This is an old revision of the document!
public key authentication
You know you can connect to a host with ssh by typing a password when requested. However it is usually easier, especially for a scripted environment, to run ssh without having to type the password. This also keeps the user password safe.
- on the connecting client, NOT the ssh server host, generate a public/private key pair (don't type a password when asked)
ssh-keygen
- this creates a private key ~/.ssh/id_rsa, and a public key ~/.ssh/id_rsa.pub
- the single line inside the public key file needs copied to a file on the ssh server host at ~/.ssh/authorized_keys
Notes
- the authorized_keys file may contain one or more lines for all the hosts that are authorized to connect
- the authorization files are per user on the host, so the appropriate user should hold the authorized_keys file