SSH-Key Sharing on Linux CentOS/RHEL/Debian/Ubuntu

SSH-Key Sharing on Linux CentOS/RHEL/Debian/Ubuntu

Hello Everyone, In this Post we will discuss how to share ssh-keys among two linux hosts.

Sharing ssh-keys allows us to ssh to remote host without entering password.

These type of things seems beneficial in those cases where we have to ssh remote host multiple times.

What we are using here is:-

EDITION HOSTNAME IP-ADDRESS
ubuntu-12.04 ubuntu.how2install.in 10.0.0.252
ubuntu-12.04 testing.how2install.in 10.0.0.253
COMMANDS-USED DESCRIPTION
ifconfig To Check IP Address
ssh-keygen -t rsa To generate ssh key
ssh-copy-id -i ~/.ssh/id_rsa.pub root@Ip-Address To Copy ssh key to remote host
ssh root@IP-Address To ssh remote host
  • Firstly we’ll show you the whole process using host with IP-10.0.0.252

1

 Here we’ll try to ssh 2nd host i.e host with ip- 10.0.0.253

2

Its prompting for password, Every time we’ll submit this command it will prompt for password.

Now what we’ll do is that we’ll share ssh-keys among these two hosts.

We can generate ssh-key using below command:-

3

 Once  generated we have to copy this key to remote host to which we want to have password less ssh-access.

4

 It will prompt for root user password of remote host, just enter root password here, we have to submit it only once.

Now ssh-key is shared & we can ssh remote host without password.

We Can check the working of password less ssh to remote host as below.

5 

  • Secondly, We have to repeat the same process on host with IP-10.0.0.253

9

 Here we’ll try to ssh 1st host i.e host with ip- 10.0.0.252

 10

Its prompting for password, Every time we’ll submit the same command it will prompt for password.

 Now what we’ll do is that we’ll share ssh-keys among these two hosts.

 First step is to generate ssh-key using below command:-

 6

Once  generated copy the ssh key to remote host to which we want to have password less ssh-access.

 7

 It will prompt for root user password of remote host, we have to submit it only once.

 Now ssh-key is shared & we can ssh remote host without password.

8

Leave a Reply

Time limit is exhausted. Please reload the CAPTCHA.