Ajeet Raina I am a Docker Captain, ARM Innovator & Docker Bangalore Community Leader. I am a maintainer of Collabnix blogging site. I work for Redis and a primary maintainer of https://developer.redis.com. I run Collabnix Community Slack with over 6500+ audience . We have built a popular projects like Docker Labs, KubeLabs, KubeTools and DockerTools. You can follow me on Twitter(@ajeetsraina) & GitHub(@ajeetraina)

How to create password-less SSH for Linux

31 sec read

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.

SSH_Dock_Icon_by_eternicode

Lab Scenerio:

Machine1: 192.168.160.194

Machine2: 192.168.160.197

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:

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

#ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.160.197

It will show you the following output.

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

.ssh/authorized_keys

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:

#ssh 192.168.160.197

Have Queries? Join https://launchpass.com/collabnix

Ajeet Raina I am a Docker Captain, ARM Innovator & Docker Bangalore Community Leader. I am a maintainer of Collabnix blogging site. I work for Redis and a primary maintainer of https://developer.redis.com. I run Collabnix Community Slack with over 6500+ audience . We have built a popular projects like Docker Labs, KubeLabs, KubeTools and DockerTools. You can follow me on Twitter(@ajeetsraina) & GitHub(@ajeetraina)

What is a Dockerfile – A Step-By-Step Guide

A Dockerfile is a text file which contains a series of commands or instructions. These instructions are executed in the order in which they...
Ajeet Raina
21 min read

Docker Desktop for Linux,  Docker Extensions and more with…

Docker Desktop 4.8.2 is now available for download for Mac, Windows and Linux. Here are the major highlights: Docker Desktop for various Linux distributions made available for the first...
Ajeet Raina
1 min read

2 Replies to “How to create password-less SSH for Linux”

  1. Hi Ajeet,
    I am looking for an approach where SSH is enabled between two containers right from deployment. Is it possible? I am able to enable SSH after the containers are deployed but that’s not what I am looking for.
    SSH enablement should be embedded in the image itself. Could you please help?
    Thanks in advance.

Leave a Reply