Generate the key
We need to create a public key, we do it in computer A:
Press always intro when asked to generate a key without passphrase. This is less secure, but it can be really useful. Now we have in our .ssh folder the keys (key-name and key-name.pub)
Copy public key
Copy the public key to the remote host you wish to access (in our example from computer A to B) and add it to the file
If that file does not exist then you should create it. Or you can use ssh-copy-id to log into a remote machine and append the indicated identity file to that machine's ~/.ssh/authorized_keys file.
ssh-copy-id [-i [identity_file]] [[email protected]]machine
In computer A run this command:
ssh -i key [email protected]_IP
If every thing is fine, you should be able to connect to computer B with this command.
Laziness is a virtue, using ssh config
You can create alias for your ssh connections, this way, you don't need to remember usernames, IPs, etc...
First, create this file:
with this content:
Now it is possible connent with this command:
Great, isn't it? For a complete connect list for the ssh config file, type