1. Create private and public keys on source server.
[root@source~]# ssh-keygen
Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/mykey <ENTER>
Created directory '/root/.ssh'
Enter passphrase (empty for no passphrase): <ENTER>
Enter same passphrase again: <ENTER>
2. Copy public key to remotehost.
[root@source~]# ssh-copy-id -i /root/.ssh/mykey.pub root@192.168.0.100
root@192.168.0.100's password: <PASSWORD FOR REMOTEHOST>
This command will copy contents of 'mykey.pub' file and appends into file "/root/.ssh/authorized_keys" on remotehost 192.168.0.100. This command also creates structure "/root/.ssh/authorized_keys" if not exists on remote host.
3. Login to remotehost.
[root@source~]# ssh root@192.168.0.100
[root@destination~]#
No comments:
Post a Comment