notes

SSH Setup

Generate keys; private key id_rsa is for client, public key id_rsa.pub is for server.

ssh-keygen -t rsa

Server

Append public key to the authorized_keys.

cat /path/to/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
rm /path/to/id_rsa.pub

Backup /etc/ssh/sshd_config.

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.ORIGINAL

Update /etc/ssh/sshd_config.

Protocol 2
AllowUsers user1 user2
PermitRootLogin no
PasswordAuthentication no
LoginGraceTime 60
MaxStartups 2
PermitEmptyPasswords no

Restart service.

sudo service ssh restart

View access log.

cat /var/log/auth.log | grep sshd

Client

Connect to server.

ssh -i /path/to/id_rsa <user>@<host>

Update ~/.ssh/config file to use alias.

Host <alias>
  HostName <host>
  User <user>
  IdentityFile /path/to/id_rsa

Connect.

ssh <alias>