Sometimes connections requires a password or a really long command,
so by adding your public key to the server you can just do something like:
Then you would be connected with no password prompt.
You may have already generated a public key, so certain steps may not apply.
1. Create RSA Key Pair
ssh-keygen -t rsa
This is done on the client (i.e. your laptop)
2. Store Keys and Set Optional Passphrase
After running the above command, you'll get a prompt for where to save the key
and to set a optional password for it. Setting a password would require you to
enter it every time you use the key. Below is a sample output:
3. Copy Public Key
Once you have the public key generated, you can copy it to the target machine's
(i.e. server) authorized_keys with the following command:
If the previous doesn't work, you can also paste the key directly:
cat ~/.ssh/id_rsa.pub | ssh firstname.lastname@example.org "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
Now you should be able to connect as
email@example.com without a password.