How to omit entering password for SSH on Ubuntu

Doing SSH is essential for efficient programming as you know. However, that each time you try to enter your remote machine through SSH you need to enter your password, is such a pain to us.
There’s a way to omit entering your password each time of SSH, and It’s quite a easy step.

Firstly, you need to create a file through following command. This command let you craete your host machine’s public key. You need to share this key file between remote machines as you need in the later steps.
You will be prompted on the command, all you need to do is type your enter key to proceed. You can bypass the file name, password as empty values here.

ssh-keygen -t rsa

Then create folder for storing the file through SSH.

ssh {{USER}}@{{IP}} mkdir -p ~/.ssh

Copy the key flie to the folder on the remote machine.

cat ~/.ssh/id_rsa.pub | ssh {{USER}}@{{IP}} 'cat >> ~/.ssh/authorized_keys'

That’s it!

In the end, the entire commands you need to run are like following ones as a example.

ssh-keygen -t rsa

ssh yuis@192.168.0.102 mkdir -p ~/.ssh
cat ~/.ssh/id_rsa.pub | ssh yuis@192.168.0.102 'cat >> ~/.ssh/authorized_keys'

After done the above steps, you can ensure whether you can enter your remote machine without entering password.

ssh yuis@192.168.0.102
# ssh {{USER}}@{{IP}}

You may also like...