Pages

Tuesday, November 22, 2011

Configure SSH Key-Based Authentication on a Linux Server


 v  Log into server1 using putty
[root@server1 ~]#

v  Create the public key type bellow command to process
[root@server1 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
92:e8:11:f9:91:3a:7a:71:9b:ed:13:86:67:69:f3:9c root@server
now public key creating done, we need to copy it to server2 root folder

v  Copy the created file to server that you wish to connect server  without password
[root@server1 ~]# scp ~/.ssh/id_rsa.pub root@server2:/root

v  Log in to server 2
 [root@server1~]# ssh  server2

v  Copied file append to the authorized  keys file
[root@server2~]#cat id_rsa.pub >> .ssh/authorized_keys

v  And after copy id_rsa.pub file to server2 delete the file from server1 (it optional )
[root@server2~]rm -fr  id_rsa.pub

v  Now you will be able to connect without password server1 to server2

No comments:

Post a Comment