SSH login using key only
Connect to remote server using local machine/client ssh key for authentication.
- Generate SSH key using the command ssh-keygen in OS X and Linux terminal if is not already generated at /.ssh. Window user can use PuttyGen.
- Copy client ssh key to remote machine authorized_key file
cat ~/.ssh/id_rsa.pub | ssh firstname.lastname@example.org “mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys”
- Edit remote machine /etc/ssh/sshd_config PasswordAuthentication no RSAAuthentication yes PubkeyAuthentication yes
Bonus: Generate server private key for anywhere access using key only
- Generate key on server ssh-keygen
- Put the key into authorized_key file echo `cat ~/.ssh/uploaded_key.pub` >> ~/.ssh/authorized_keys
- Copy key from machine to local machine using SCP scp email@example.com:/home/user/.ssh/id_rsa ~/user/Desktop
(Edit the username, IP address and folder accordingly)
- Convert the id_rsa file to putty file for use in Putty
- Connect using Putty