SSH in 10 points
SSH is a tool to get shell access to a computer.
- SSH is used by other tools to enable connections between computers.
For instance:
rsync
andscp
use SSH to copy directories and files between computersgit
uses SSH to sync repository state between computers
- SSH can be used to get shell access on computers using the ssh
command:
ssh user@hostname
SSH requires authentication and supports two kinds: passwords and keys.
SSH password authentication will prompt you for the password of the user every time you use it.
SSH key authentication automatically authenticates using a key file stored on the computer you are connecting to.
- SSH keys come in two parts a public part and a private part.
- The public key is stored in
~/.ssh/id_rsa.pub
and can be safely shared - The private key is stored in
~/.ssh/id_rsa
and should never be shared
- The public key is stored in
SSH key pairs can be created by running
[[ ! -e ~/.ssh/id_rsa ]] && ssh-keygen -t rsa
SSH key authentication access to a computer is enabled by adding to its
~/.ssh/authorized_keys
file the public keys of aproved computers.- SSH public keys can be added to remote computers using
scp
and password authentication:cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'