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:

ssh user@

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:

ssh-copy-id user@

If the previous doesn't work, you can also paste the key directly:

cat ~/.ssh/ | ssh user@ "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Now you should be able to connect as user@ without a password.