Sometimes you might need setting up Password-less SSH for running script or for application where you dont want to use password everytime. Here is a quick method to setup password-less SSH.


Lab Scenerio:



a. Run this command on Machine1:

#ssh-keygen -t rsa

It will show you this output. Just press Enter throughout the queries asked.

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/

The key fingerprint is:


The key’s randomart image is:

+–[ RSA 2048]—-+

| ooB …..|

| * B . . .|

| * E + . .|

| + o + . . |

| S + . . |

| . + |

| . . |

| |

| |


b. Let’s copy the key to remote Machine2:

#ssh-copy-id -i ~/.ssh/ root@

root@’s password:

It will show you the following output.

Now try logging into the machine, with “ssh ‘root@′”, and check in:


to make sure we haven’t added extra keys that you weren’t expecting.

c. Now passwordless SSH is ready. Just test by typing this:



Categories: Docker

Ajeet Raina

My name is Ajeet Singh Raina and I am an author of this blogging site. I am a Docker Captain, ARM Innovator & Docker Bangalore Community Leader. I bagged 2 special awards last year(2019) : Firstly, “The Tip of Captain’s Hat Award” at Dockercon 2019, San Francisco and secondly, “2019 Docker Community Award“. I was overwhelmed to receive the first award in front of around 5000 audience.

1 Comment

MonroeOYpina · 21st November 2016 at 8:48 am

It’s very trouble-free to learn any matter on net in comparison with textbooks, while i found this article
at this website.

Leave a Reply

Your e-mail address will not be published. Required fields are marked *