Linux SSH login without password

client1: Linux Host
server1: Linux Host
client server Generate key(Public key and Private key), copy the Public key to server1

1.client1 Generate key

[root@client1 ~]# ssh-keygen -b 1024 -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):   #Key storage Path
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/  
The key fingerprint is:

-b 1024  length of the key(Public key and Private key) is 1024 Byte, max length is 4096 Byte.
-t rsa   the key(Public key and Private key) is by rsa Encryption, In addition there ssh dsa way, rsa way length not less than 768 Bytes

2.copy the public key to server1

[root@server1 ~]# scp /root/.ssh/ root@
The authenticity of host ' (' can't be established.
RSA key fingerprint is 91:a9:f9:6c:cd:6b:69:69:78:e0:f0:0f:a1:7f:c3:d8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
root@'s password:                                                                                                   100%  226     0.2KB/s   00:00

3.server1 set authorized_keys

[root@server1 ~]# mkdir .ssh
[root@server1 ~]# cat >> .ssh/authorized_keys
[root@server1 ~]# chmod -R 600 .ssh
[root@server1 ~]# ll .ssh/authorized_keys
-rw------- 1 root root 226 07-19 23:54 .ssh/authorized_keys
[root@server1 ~]#

4.client1 login to server1

[root@server3 ~]# ssh -lroot
Enter passphrase for key '/root/.ssh/id_rsa': (If you set up, you need to fill in)            
Last login: Fri Jul 20 00:39:36 2012 from
[root@server4 ~]#

Pingbacks are closed.

Comments are closed.