SSH Secure Shell Key-based Authentication

 

SSH key-based Authentication

This is for linux-to-linux ssh connections. The process for Windows-to-Linux is not covered.

1. Generate a key pair by running the following command (from your workstation or laptop):
#>key-gen -t dsa (on newer systems, this command is ssh-keygen)

-don't enter a passphrase (unless you want to). Leave the passphrase empty.
-this will create the files $HOME/.ssh/id_dsa and $HOME/.ssh/id_dsa.pub
-the file without an extension is your private key. The other is your public key.

2. Securely copy your public key to the remote machine. Specifically, copy the contents of your public key to your $HOME/.ssh/authorized_keys2 file on the remote machine. Make sure the permissions of authorized_keys2 on the remote machine is 0600 and owned by you.

3. Now when you use ssh to connect from your workstation to the remote machine, you won't be prompted for a password. The connection will use the dsa key for authentication.