SSH

Key Management

Generate new key:

ssh-keygen -f $HOME/.ssh/id_[name] -C "[comment]"

Deploy key to host:

ssh-copy-id -i $HOME/.ssh/id_[name] [username]@[hostname]

Change key passphrase:

ssh-keygen -p -f $HOME/.ssh/id_[name]

Client Configuration

Use the following example to create your $HOME/.ssh/config configuration file:

##########
# Global #
##########
AddKeysToAgent yes
IdentityFile ~/.ssh/id_mainkey


#########
# Hosts #
#########
Host server1
    HostName server1.example.org
    User root

Tip

man ssh_config