1.配置在1服务器(192.168.0.200)上无密码登录远程机器
[root@1 ~]# su - 1
[nagios@1 ~]$ ssh-keygen -t rsa  
# 下面一直回车,不要设置密码  
Generating public/private rsa key pair.  
Enter file in which to save the key (/home/nagios/.ssh/id_rsa):  
Enter passphrase (empty for no passphrase):  
Enter same passphrase again:  
Your identification has been saved in /home/nagios/.ssh/id_rsa.  
Your public key has been saved in /home/nagios/.ssh/id_rsa.pub.  
The key fingerprint is:  
d2:82:61:12:53:f9:53:75:77:8d:32:c0:ca:c8:20:60 nagios@nagios.itech.com  
 
# 将生成的密钥拷贝到要远程登录的机器上 
[nagios@1 ~]$ scp .ssh/id_rsa.pub 192.168.0.210:/home/nagios/ 
nagios@192.168.0.210's password: 
id_rsa.pub                                                        100%  233     0.2KB/s   00:00 
 
# 在要远程登录的机器上配置公钥 
[nagios@nagios ~]$ scp .ssh/id_rsa.pub 192.168.0.210:/home/nagios/ 
nagios@192.168.0.210's password: 
id_rsa.pub                                                        100%  233     0.2KB/s   00:00 
 
# 在要远程登录的机器上配置公钥 
[nagios@nagios ~]$ ssh nagios@192.168.0.210 
nagios@192.168.0.210's password: 
Last login: Sat Nov 29 22:30:55 2008 from 192.168.0.200 
[nagios@nagios1 ~]$ cat id_rsa.pub >> .ssh/authorized_keys 
[nagios@nagios1 ~]$ chmod 600 .ssh/authorized_keys 
[nagios@nagios1 ~]$ exit 
logout 
Connection to 192.168.0.210 closed. 
 
# 测试无密码登录 
[nagios@nagios ~]$ ssh nagios@192.168.0.210 
Last login: Sat Nov 29 22:35:27 2008 from 192.168.0.200