Creating SSH keys

SSH keys provide secure authentication and access to remote machines and as a result can allow secure logins without passwords. As such, this is a secure method to speed up logging in to frequently-accessed remote machines.



Instructions for a Mac/Linux local machine

  • launch Terminal or Command Line
  • generate the keys:
    • ssh-keygen -t rsa 
    • hit enter to save the key in the default ~/.ssh/id_rsa
    • hit enter for no passphrase
  • secure the keys:
    • chmod -R go= ~/.ssh
  • copy the public key to the remote account home folder:
    • scp ~/.ssh/ username@remoteserver:
  • switch to Terminal or Command Line on the remote machine

  • create the directory to store the public key:
    • mkdir ~/.ssh
  • append the public key to the appropriate file:
    • cat ~/ >> ~/.ssh/authorized_keys
  • remove the public key from home folder:
    • rm ~/
  • secure the directory:
    • chmod -R go= ~/.ssh
  • test secure authentication to the remote machine; it should no longer require a password
    • ssh username@remoteserver