SSH Keys are wonderful and easy to set up. You can SSH keys to quickly log into a remote server (like your website) from the command line WITHOUT a password prompt.
How does it work?
Essentially SSH works by generating two keys (strings) on your machine: a public and a private one. You place the public key on a external server and when you log in the server makes the connection and access is granted.
How do I do it?
Setting up SSH can be done in as little as two steps:
- Generate SSH key Pair
- Copy public key to remote server (where you want to login)
Generate SSH Key Pair
First generate the SSH key pair with ssh-keygen
.
ssh-keygen -t rsa
You will be asked where you want to store the file and whether or not you want a password, I just click ENTER
twice.
Copy the public SSH key
Use ssh-copy-id to quickly move the public SSH key to the remote server.
ssh-copy-id user@example.com
You must know the username of server you are trying to access.