SSH Keys

From RHLUG Wiki
Jump to: navigation, search

Using keys are more secure than using passwords for SSH, and easier since you don't need to keep entering the password to the remote machine.

Generating a Key

Basically just run the following command and hit enter 3 times to accept the defaults:

ssh-keygen -t rsa

Put Key on a Remote Machine

Run the following line to put the key on the remote machine. Be sure to change the REMOTE_USER and REMOTE_IP with your machine's info:

cat ~/.ssh/id_rsa.pub | ssh REMOTE_USER@REMOTE_IP "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"