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
ssh-keygen
use the above command to generate SSH keys on source machine.
Enable Password Authentication
Open sshd_config file
sudo vi /etc/ssh/sshd_config
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijHWctP1QcExWKcyG1aC2yGZ4PPVc0LboWWrdZyAsHI1oq-rA16HbMsXSrR6LmmIWZAItIlb99IAOBRwLcPThvjFG_gtLW83dpSVGW6YeuVncD793qClrK8if8smkjYbr2zrhbLokhdlE-/s320/Screen+Shot+2019-08-07+at+7.00.40+PM.png)
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. Generate Keys
ssh-keygen
use the above command to generate SSH keys on source machine.
Enable Password Authentication
Open sshd_config file
sudo vi /etc/ssh/sshd_config
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijHWctP1QcExWKcyG1aC2yGZ4PPVc0LboWWrdZyAsHI1oq-rA16HbMsXSrR6LmmIWZAItIlb99IAOBRwLcPThvjFG_gtLW83dpSVGW6YeuVncD793qClrK8if8smkjYbr2zrhbLokhdlE-/s320/Screen+Shot+2019-08-07+at+7.00.40+PM.png)
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
This comment has been removed by the author.
ReplyDelete