Sometimes connecting to a server with SSH is very tedious, enter the password at anytime is boring.
Create a RSA password
Go to your home
If not exist, create a directory named '.ssh'
Create a password in that directory
cd .ssh/ ssh-keygen -t rsa -f pass
This will generate 2 keys, one public and another private, 'pass.pub' and 'pass'. 'pass' is our private key, this means that we have not to share it, 'pass.pub' is our public key and is the key that we have to export to the server.
Create the authorized_keys file in your server
Connect with the server that you want to connect without password through SSH (o another protocol):
If not exist, create a directory called '.ssh' in your home, and then, into it another file named 'authorized_keys':
cd mkdir .ssh touch .ssh/authorized_keys
Import your password to the server
Don't close the console, open a new one and copy the public key (the content of the 'pass.pub' file)
Select all the content and copy it (Ctrl+Shift+C) Now open the last console (where you stay logged into the server, if you had closed it, reconnect) Ahora abre la terminal de antes (En la que estás logeado en el servidor) (Si la has cerrado vuelve a logearte) and paste the public key into the authorized_keys file, after logout.
vim .ssh/authorized_keys exit
Import the key into the ssh agent
In your local machine:
cd ssh-add .ssh/pass
At this moment you can enter into the server without password.
Important: If we have setted an external key (Like our case), every time that the agent inits (every time that we reboot the machine) we have to repeat the step 4 for correct identity import.