rsync故障排除解答

排除故障 
***************************
1.@ERROR: auth failed on module xxxxx
    rsync: connection unexpectedly closed (90 bytes read so far)
    rsync error: error in rsync protocol data stream (code 12) at io.c(150)
    這是因爲密碼設錯了, 無法登入成功, 請檢查一下 rsyncd.scrt 中的密碼, 二端是否一致? 

2.password file must not be other-accessible 
    continuing without password file 
    Password:
    這表示 rsyncd.scrt 的檔案權限屬性不對, 應設爲 600。

3.@ERROR: chroot failed
    rsync: connection unexpectedly closed (75 bytes read so far)
    rsync error: error in rsync protocol data stream (code 12) at io.c(150)   
    這通常是您的 rsyncd.conf 中的 path 路徑所設的那個目錄並不存在所致.請先用 mkdir開設好要備份目錄

4.@ERROR: access denied to www from unknown (192.168.1.123)
    rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
    rsync error: error in rsync protocol data stream (code 12) at io.c(359)
    最後原因終於找到了。因爲有兩個網段都需要同步該文件夾內容,但沒有在hosts allow 後面添加另一個IP段
    hosts allow = 192.168.1.0/24
    改爲
    hosts allow = 192.168.1.0/24 192.168.2.0/24
    重新啓動rsync服務,問題解決 

5.rsync: failed to connect to 172.21.50.8: No route to host (113)
    rsync error: error in socket IO (code 10) at clientserver.c(104) [receiver=2.6.9]
    對方沒開機、防火牆阻擋、通過的網絡上有防火牆阻擋,都有可能。關閉防火牆,其實就是把tcp udp 的873端口打開
    啓動服務:rsync --daemon --config=/etc/rsyncd.conf

6.@ERROR: auth failed on module backup
    rsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.7]
    client端沒有設置/etc/rsync.pas這個文件,而在使用rsync命令的時候,加了這個參數--password-file=/etc/rsync.scrt 

7.rsync: recv_generator: mkdir "/teacherclubBackup/rsync……" failed: No space left on device (28)
    *** Skipping any contents from this failed directory ***
    磁盤空間滿了 

8.rsync: opendir "/kexue" (in dtsChannel) failed: Permission denied (13)
    同步目錄的權限設置不對,改爲755 

9.rsync: read error: Connection reset by peer (104)
    rsync error: error in rsync protocol data stream (code 12) at io.c(759) [receiver=3.0.5]
    未啓動xinetd守護進程
    [root@CC02 /]# service xinetd start

10.rsync: unable to open configuration file "/etc/rsyncd.conf": No such file or directory
    xnetid查找的配置文件位置默認是/etc下,在/etc下找不到rsyncd.conf文件

11.rsync: failed to connect to 203.100.192.66: Connection timed out (110)
    rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5]
    連接服務器超時,檢查服務器的端口netstat –tunlp,遠程telnet測試

12.[root@client cron.daily.rsync]# sh root.sh  
    ERROR: password file must not be other-accessible
    rsync error: syntax or usage error (code 1) at authenticate.c(175) [Receiver=3.0.9]
    創建密碼文件,root用戶用的是 rsyncroot.password,權限是600

13.如何通過ssh進行rsync,而且無須輸入密碼?
  可以通過以下幾個步驟
  1. 通過ssh-keygen在server A上建立SSH keys,不要指定密碼,你會在~/.ssh下看到identity和identity.pub文件 
  2. 在server B上的home目錄建立子目錄.ssh
  3. 將A的identity.pub拷貝到server B上
  4. 將identity.pub加到~[user b]/.ssh/authorized_keys
  5. 於是server A上的A用戶,可通過下面命令以用戶B ssh到server B上了。e.g. ssh -l userB serverB。這樣就使server A上的用戶A就可以ssh以用戶B的身份無需密碼登陸到server B上了。

14.如何通過在不危害安全的情況下通過防火牆使用rsync?
  解答如下:
   這通常有兩種情況,一種是服務器在防火牆內,一種是服務器在防火牆外。無論哪種情況,通常還是使用ssh,這時最好新建一個備份用戶,並且配置sshd 僅允許這個用戶通過RSA認證方式進入。如果服務器在防火牆內,則最好限定客戶端的IP地址,拒絕其它所有連接。如果客戶機在防火牆內,則可以簡單允許防 火牆打開TCP端口22的ssh外發連接就ok了。

15.我能將更改過或者刪除的文件也備份上來嗎?
  當然可以。你可以使用如:rsync -other -options -backupdir = ./backup-2000-2-13  ...這樣的命令來實現。這樣如果源文件:/path/to/some/file.c改變了,那麼舊的文件就會被移到./backup- 2000-2-13/path/to/some/file.c,這裏這個目錄需要自己手工建立起來

16.我需要在防火牆上開放哪些端口以適應rsync?
  視情況而定。rsync可以直接通過873端口的tcp連接傳文件,也可以通過22端口的ssh來進行文件傳遞,但你也可以通過下列命令改變它的端口:
  rsync --port 8730 otherhost::
  或者
  rsync -e 'ssh -p 2002' otherhost:

17.我如何通過rsync只複製目錄結構,忽略掉文件呢? 
  rsync -av --include '*/' --exclude '*' source-dir dest-dir

18.爲什麼我總會出現"Read-only file system"的錯誤呢?
  看看是否忘了設"read only = no"了


19. uid 4294967295 (-1) is impossible to set on

        在server端添加一行參數:

        fake super = yes

        重啓rsync服務即可。再同步就不會出現錯誤信息了。



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章