Wednesday, August 7, 2019

How to copy SSH keys from one machine to other machine - How to transfer SSH keys into target server

Let's say you have two servers - Host_A & Host_B, you would like to copy SSH keys from A to B. You need to generate keys and use ssh-copy-id command to transfer keys from source machine to target machine.

1. Generate Keys


use the above command to generate SSH keys on source machine.

Enable Password Authentication

Open sshd_config file

sudo vi /etc/ssh/sshd_config

Enable password authentication by changing to yes

Restart ssh service

sudo service sshd restart

2. ssh-copy-id

ssh-copy-id Host_B

say yes and enter

After this, make suue you are able to ssh into Host_B

ssh Host_B

1 comment: