SSH

Setup keypair with remote server

Create a key

ssh-keygen

Copying the public key to the server

ssh-keygen

Assumes that the user can authenticate with a password

ssh-copy-id username@remote_host

Manually

On client

cat ~/.ssh/id_rsa.pub

On server

mkdir -p ~/.ssh
echo public_key_string >> ~/.ssh/authorized_keys

Adding a key to the ssh-agent

For services like git, it may look to the ssh-agent to see that the appropriate key is present. To add a new key run

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/<keyname>

Adjust SSH settings

The settings file for ssh is found at /etc/ssh/sshd_config. An easy improvement is to disable root login is by setting the following line.

PermitRootLogin no