Public Key Authentication
John Simpson has a nice set of detailed instructions for setting this up as well.
Server Setup
On the machine you want to connect to, make sure the necessary SSH directory and key files are in the home directory of the user you are going to connect to the server as:
mkdir -m 700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keysClient
On the client, the machine you will be connecting to a server from, create public and private keys. If you want to use the key for automated tasks leave it empty, otherwise supply a pasphrase when prompted.
ssh-keygen -t dsaPossible configuration options:
-b <ebits>- default is 2048, sufficient for most needs-C <comment>- add comment to the key
The public key ~/.ssh/id_dsa.pub needs to be copied to the server that you are going to connect to:
cat ~/.ssh/id_dsa.pub | ssh <username>@<server> "cat >> ~/.ssh/authorized_keys"Then you should be able to connect to the server without entering a password:
ssh <username>@<server>Technology:
- Log in to post comments