SFTP를 실행할 수 없음: 128 "SFTP 서버가 실행 중입니까?"를 반환합니다.

SFTP를 실행할 수 없음: 128 "SFTP 서버가 실행 중입니까?"를 반환합니다.

EC2 인스턴스(Amazon Linux)(동일한 사용자, 동일한 시스템, 동일한 인증서)로 SSH를 통해 연결할 수 있지만 더 이상 sftp를 사용할 수 없습니다.

이전에는 WinScp(내 Windows7 상자를 통해)를 통해 SFTP에 로그인했지만 이제는 "종료 코드 128, sftp가 실행 중입니다"라고 표시되고 오류 로그에는 "sftp에 대한 하위 시스템 요청"만 표시됩니다.

어떻게 작동하게 할 수 있나요?

디버깅은 다음을 제공합니다.

    debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_channel_req: channel 0 request [email protected] reply 0
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req [email protected]
debug1: server_input_channel_req: channel 0 request [email protected] reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req [email protected]
debug1: temporarily_use_uid: 222/500 (e=222/500)
debug1: restore_uid: (unprivileged)
debug2: fd 8 setting O_NONBLOCK
debug1: channel 1: new [auth socket]
debug1: server_input_channel_req: channel 0 request subsystem reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req subsystem
subsystem request for sftp
debug1: subsystem: exec() /usr/libexec/openssh/sftp-server
debug2: fd 5 setting TCP_NODELAY
debug2: fd 11 setting O_NONBLOCK
debug2: fd 10 setting O_NONBLOCK
debug1: Received SIGCHLD.
debug1: session_by_pid: pid 10940
debug1: session_exit_message: session 0 channel 0 pid 10940
debug2: channel 0: request exit-signal confirm 0
debug1: session_exit_message: release channel 0
debug2: channel 0: write failed
debug2: channel 0: close_write
debug2: channel 0: send eow
debug2: channel 0: output open -> closed
debug2: channel 0: read<=0 rfd 11 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: send close
debug2: notify_done: reading
debug2: channel 0: rcvd close
debug2: channel 0: is dead
debug2: channel 0: gc: notify user
debug1: session_by_channel: session 0 channel 0
debug1: session_close_by_channel: channel 0 child 0
debug1: session_close: session 0 pid 0
debug2: channel 0: gc: user detached
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: server-session, nchannels 2
Connection closed by 1.2.3.4
debug1: channel 1: free: auth socket, nchannels 1
debug1: do_cleanup
debug1: temporarily_use_uid: 222/500 (e=222/500)
debug1: restore_uid: (unprivileged)
Transferred: sent 2472, received 2224 bytes
Closing connection to 1.2.3.4 port 42647
debug1: PAM: cleanup
debug1: PAM: closing session
debug1: PAM: deleting credentials

업데이트: 문제는 .bashrc를 편집하여 stdout에 무언가를 출력한다는 것입니다. sftp는 사용자를 위해 새 쉘을 시작하고 그것을 좋아하지 않기 때문에 종료 코드 128로 실패합니다.

답변1

Subsystem sftp <path>sshd 구성을 살펴보십시오 /etc/ssh/sshd_config.<path>SFTP 서버를 가리킵니다(경로는 다양하지만 일반적으로 로 끝남 openssh/sftp-server). 서버가 실행 가능한지 확인하십시오.

$ grep sftp /etc/ssh/sshd_config
하위 시스템 sftp /usr/lib/openssh/sftp-server

$ /usr/lib/openssh/sftp-서버 -h
사용법: sftp-server [-ehR] [-f log_facility] [-l log_level] [-u umask]

대체 포트에서 디버그 모드로 sshd를 실행해 보세요.

#sshd-rddp 1234

하위 시스템 요청이 실패한 정확한 이유가 표시되어야 합니다.

관련 정보