To access SSH without entering password every time.
You can generate a public/private key pair, and authorize the public key on remote server.
Essential if your need to run automated scripts.
Works on Linux / Mac / Windows (Under bash)
(For Windows + PuTTY, check the tutorial here)
- Prepare public/private on your LOCAL machine
ssh-keygenunder bash (Press ENTER 3 times without entering passphrase)
Your you get your public key is under
~/.ssh/id_rsa.pub, and private key under
- SSH to REMOTE machine with password
On the REMOTE account you want to have access to,
sudo -iif your want to authorize root
Paste the content of
~/.ssh/id_rsa.pubon your LOCAL machine.
- Disconnect from your REMOTE machine, and try to
No password will be prompted if key is installed correctly.
Hints 1: ssh / rsync… etc command automatically pickup private key in
If you have multiple key pair, you can specify it with
ssh 18.104.22.168 -i ~/.ssh/id_rsa_other,
or set it permanently by
~/.ssh/config, follow tutorial here
Hints 2: If you connect to remote user name different than your local user name,
ssh email@example.com every time, you can edit
~/.ssh/config and add config just like previous hint.
So you can simplify your command from
ssh firstname.lastname@example.org -i ~/.ssh/id_rsa_other to
Host 22.214.171.124 User root IdentityFile ~/.ssh/id_rsa_other