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
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
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