E’ molto semplice, la cosa principale è che computer locale e computer remoto contengano nella cartella nascosta
/home/user/.ssh
lo stesso file di nome authorized_keys
- Create a public ssh key, if you haven’t one already.
Look at ~/.ssh. If you see a file named id_dsa.pub then you obviously already have a public key. If not, simply create one. ssh-keygen -t dsa should do the trick.
Please note that there are other types of keys, e.g. RSA instead of DSA. I simply recomend DSA, but keep that in mind if you run into errors. - Make sure your .ssh dir is 700:
chmod 700 ~/.ssh - Get your public ssh key on the server you want to login automatically.
A simple scp ~/.ssh/id_dsa.pub remoteuser@remoteserver.com: is ok. - Append the contents of your public key to the ~/.ssh/authorized_keys and remove it.
Important: This must be done on the server you just copied your public key to. Otherwise you wouldn’t have had to copy it on your server.
Simply issue something like cat id_dsa.pub >> .ssh/authorized_keys while at your home directory. - Instead of steps 3 and 4, you can issue something like this:
cat ~/.ssh/id_dsa.pub | ssh -l remoteuser remoteserver.com ‘cat >> ~/.ssh/authorized_keys’ - Remove your public key from the home directory on the server.
- Done!
You can now login:
ssh -l remoteuser remoteserver.com or ssh remoteuser@remoteserver.com without getting asked for a password.
Vai articolo originale: http://carlonicolini.altervista.org/index.php/Informatica-e-Web/Notizie-dal-web/come-loggarsi-in-automatico-senza-richiesta-della-password-con-ssh.html