종종 SFTP를 이용해 서버에 파일을 업로드 하는데 갑자기 클라이언트에서 Connection timeout으로 접속이 되지 않는 문제가 발생.


서버에 로그를 확인해보니, 연결되자 마자 클라이언트에서 연결을 끊는다.

  
    $ tail -f /var/log/secure

    Accepted password for heisice from x.x.x.x port x ssh2
    pam_unix(sshd:session): session opened for user heisice by (uid=0)
    Received disconnect from x.x.x.x port x:11: disconnected by user
    Disconnected from x.x.x.x port x
    pam_unix(sshd:session): session closed for user heisice

그래서 클라이언트에서 command line sftp클라이언트에 -v 옵션을 주어 실행해보니,

  
    $ sftp -i ~/.ssh/key -v heisice@server.com

    ...

    debug2: fd 5 setting TCP_NODELAY
    debug2: client_session2_setup: id 0
    debug1: Sending environment.
    debug1: Sending env LANG = ko_KR.UTF-8
    debug2: channel 0: request env confirm 0
    debug1: Sending subsystem: sftp
    debug2: channel 0: request subsystem confirm 1
    debug2: channel_input_open_confirmation: channel 0: callback done
    debug2: channel 0: open confirm rwindow 0 rmax 32768
    debug2: channel 0: rcvd adjust 2097152
    debug2: channel_input_status_confirm: type 99 id 0
    debug2: subsystem request accepted on channel 0
    Received message too long 1315927840
    debug2: channel 0: read<=0 rfd 6 len 0
    debug2: channel 0: read failed
    debug2: channel 0: close_read
    debug2: channel 0: input open -> drain
    debug2: channel 0: ibuf empty
    debug2: channel 0: send eof
    debug2: channel 0: input drain -> closed
    debug2: channel 0: write failed
    
    ...


Received message too long 이라는 메세지가 보였다.


그래서 구글링 해보니 ssh 접속시 나오는 메세지 때문에 그런경우가 있다고 한다.
얼마전에 ~/.bashrc 파일에 추가해둔 초기화 명령에서 출력되는 메세지 때문에 그런듯 하다.

그래서 그 부분을 출력하지 않게 했더니 문제가 해결되었다.

+ Recent posts