next up previous contents
Next: Code Injection Up: SSH 相關問題 Previous: Connection reset by peer   Contents

SCP RSYNC Not Work

  1. SSH 連線正常,但 scp rsync 卻卡住,顯示除錯過程,卡在 exec request accepted on channel 0
    [root@dns ~]# scp -vvvvv aaa 163.17.27.219:
    .....
    debug2: channel_input_status_confirm: type 99 id 0
    debug2: exec request accepted on channel 0
    debug3: Wrote 64 bytes for a total of 1573
    
  2. rsync 出現以下錯誤訊息。
    [root@dywang ~]# rsync -v aaa 163.17.27.219:
    reverse mapping checking getaddrinfo for e.csie.personal.static.219
    .ippool.cyut.edu.tw [163.17.27.219] failed - POSSIBLE BREAK-IN ATTEMPT!
    protocol version mismatch -- is your shell clean?
    (see the rsync man page for an explanation)
    rsync error: protocol incompatibility (code 2) at compat.c(171) [sender=3.0.6]
    
  3. SSH 要連線的遠端修改以下設定後,重新啟動 sshd 服務。
    [root@dyw219 ~]# vim /etc/ssh/sshd_config 
    [root@dyw219 ~]# egrep '^(UseDNS|GSSAPIAu)' /etc/ssh/sshd_config 
    GSSAPIAuthentication no
    UseDNS no
    [root@dyw219 ~]# /etc/init.d/sshd restart
    
  4. 再執行 rsync 連線,錯誤訊息減少如下:
    [root@dywang ~]# rsync -v aaa 163.17.27.219:
    protocol version mismatch -- is your shell clean?
    (see the rsync man page for an explanation)
    rsync error: protocol incompatibility (code 2) at compat.c(171) [sender=3.0.6]
    
  5. 出現以上錯誤訊息,主要是連線時取得 shell 時的設定或腳本有問題,經檢查是 /etc/bashrc 環境變數 TERM 造成,移除後正常。
    [root@dyw219 ~]# diff -uN /etc/bashrc scptmp/bashrc 
    --- /etc/bashrc	2013-10-02 17:06:18.000000000 +0800
    +++ scptmp/bashrc	2017-06-26 07:44:11.000000000 +0800
    @@ -84,3 +84,4 @@
         unset pathmunge
     fi
     # vim:ts=4:sw=4
    +env TERM=linux setterm -regtabs 4
    


2017-10-27