配置SSH免密码登录:

需要先关闭selinux,否则会互信失败

[root@rhel-1 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
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:
95:77:9d:9b:1d:43:5d:19:32:f2:7e:ad:97:f5:56:be root@rhel-1
[root@rhel-1 ~]#

此时还需要输入密码

[root@rhel-1 ~]# scp .ssh/id_rsa.pub root@192.168.100.249:/root
[root@rhel-2 ~]# cat id_rsa.pub >> .ssh/authorized_keys
[root@rhel-2 ~]# chmod 600 .ssh/authorized_keys
[root@rhel-1 ~]# ssh 192.168.100.249
Last login: Fri Jun 12 09:27:00 2015 from 192.168.100.251
[root@rhel-2 ~]#