3)服务器2登陆服务器1不用密码
[root@centos1 unison-2.40.63]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
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:
be:43:3a:24:4c:83:fe:bd:22:e2:ed:c2:89:7e:ab:c9 root@centos1
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| . |
| . o |
| . o . S |
| . o ... |
|o .. + o. |
|+++.o + .. |
|oE==...o.. |
+-----------------+
[root@centos1 unison-2.40.63]# scp ~/.ssh/id_rsa.pub 2.2.2.135:/root/.ssh/authorized_keys
[root@centos1 unison-2.40.63]# ssh 2.2.2.135
Last login: Tue Dec 17 13:26:06 2013 from centos1
[root@centos ~]#
4)服务器1,2文件同步
[root@centos1 bin]# unison /home ssh://root@2.2.2.145:/home --文件同步
[root@centos1 bin]# unison /home ssh://root@2.2.2.145:/home --path 目录 --只同步指定的目录