from Linux by Examples by mysurface
Search though google, there are a tons of tutorial for accessing a remote site through ssh without a password. I found some tutorial gives too much details. Sometimes, detail’s explanation may confuse the beginners. I just want to make things done, I don’t want to know too much about the public key, private key and network authentication’s stuff. Therefore, I am here to provide the clean steps without further explanation .
Let say you want to access to a machine with IP 10.0.0.4, and make sure you have command ssh, ssh-keygen, ssh-copy-id.
First, generate the ‘key’, the key will be used to open the remote machine’s door.
ssh-keygen
You will see something like that
Enter file in which to save the key (/home/myname/.ssh/id_rsa):
Whatever it appears just press enter until it ends, press enter for passphase as well.
Okay, the ‘key’ will be generated, something looks like ~/.ssh/id_rsa.pub
Copy over the ‘key’ to remote machine, and enter your password
ssh-copy-id -i ~/.ssh/id_rsa.pub mysurface@10.0.0.4
Done. Now you can ssh 10.0.0.4 with username mysurface without password.
ssh mysurface@10.0.0.4