ref : http://dz.adj.idv.tw/thread-48-1-4.html

1.完成單向Trusted SSH Authorized﹕
我要 A (10.0.0.1) 要對 B (192.168.0.1) 做異地備援 ...所以我針對 A 讓它使用SSH連到 B 時...不需要輸入密碼...User 是 Root...SSH Version2的版本..首先要先在A(10.0.0.1)產生public/private dsa key pair..

[root@mondeo home]# cd /root/.ssh/
[root@mondeo .ssh]# ssh-keygen -d
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase): <-- 此處不打passphrase..下次才不會詢問password
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
11:22:33:44:55:66:77:88:99:00:11:22:33:44:55:66 root@mondeo.adj.idv.tw
[root@mondeo .ssh]#

這時會在系統下看到兩個檔案...id_dsa與id_dsa.pub 現在要把id_dsa.pub丟到192.168.0.1 並且更名為 authorized_keys2

[root@mondeo .ssh]# scp id_dsa.pub 192.168.0.1:/root/.ssh/authorized_keys2
root@192.168.0.1's password:
id_dsa.pub 100% |***************************************************************************| 612 00:00
[root@mondeo .ssh]#

現在您可以執行ssh 192.168.0.1 看看能否登入而不需要輸入密碼...

2. 裝 rsync  and turn on rsync daemond

3.command  : 

rsync -avlR --delete -e 'ssh -p 6211' /home/littlex/source/ 123.111.111.111/var/www/html

    全站熱搜

    阿貴貴 發表在 痞客邦 留言(0) 人氣()