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:
rsyncandscpuse SSH to copy directories and files between computersgituses 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.puband can be safely shared - The private key is stored in
~/.ssh/id_rsaand 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 rsaSSH key authentication access to a computer is enabled by adding to its
~/.ssh/authorized_keysfile the public keys of aproved computers.- SSH public keys can be added to remote computers using
scpand password authentication:cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'