Client: 192.168.0.2
Server: 192.168.0.1
### Client Generate Key ###
[root@Client ~]# ssh-keygen -t rsa -b 1024
The command generates public/private ‘RSA’ key pair. The -t
option selects the algorithm and the -b
option selects the key size.
### Transfer the Public Key ###
[root@Client ~ ]# scp id_rsa.pub root@192.168.0.1:~/
ssh root@192.168.0.1
[root@Server ~]# cat ~/.ssh/id_rsa.pub >> authorized_keys
The ‘authorized_keys’ is used to identify SSH keys that can be used for logging into the user account.
### Test ###
[root@Client ~]# ssh root@192.168.0.1