SSH Notes

Every time I install a new server I go through the process of setting up SSH keys for easy access. I wrote this documentation a few years ago so that I didn’t have to look it up on the web every time I need it. Now I figured I would post it on the web for others to access.

  1. Generate private/public keys on A:
    • $ ssh-keygen -t dsa
    • Press enter when it asks for the filename.
    • Press enter when it asks for the passphrase (yes, a blank passphrase) this will generate two files: ~/.ssh/id_dsa and ~/.ssh/id_dsa.pub.
  2. Put ~/.ssh/id_dsa.pub from A into ~/.ssh/authorized_keys2 on B:
    • $ cat ~/.ssh/id_dsa.pub | ssh B ‘cat >> ~/.ssh/authorized_keys2’
  3. Make sure all files are not writable or readable except by owner on both A and B:
    • $ chmod a-x,go-w,o-r ~/.ssh/*
  4. Verify it works:
    • $ ssh B ls -la
This entry was posted in Linux. Bookmark the permalink.

Leave a Reply