SSH login using key only

Connect to remote server using local machine/client ssh key for authentication.

  1. 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.
  2. Copy client ssh key to remote machine authorized_key file
    cat ~/.ssh/ | ssh user@ “mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys”
  3. Edit remote machine /etc/ssh/sshd_config PasswordAuthentication no RSAAuthentication yes PubkeyAuthentication yes

Bonus: Generate server private key for anywhere access using key only

  1. Generate key on server ssh-keygen
  2. Put the key into authorized_key file echo `cat ~/.ssh/` >> ~/.ssh/authorized_keys
  3. Copy key from machine to local machine using SCP scp user@ ~/user/Desktop
    (Edit the username, IP address and folder accordingly)
  4. Convert the id_rsa file to putty file for use in Putty
  5. Connect using Putty
Like what you read? Give Joel a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.