Filezilla나 PuTTY를 사용하지 않고 SFTP에 연결할 수 없습니다(client_loop: 연결 끊김 전송: 깨진 파이프).

Filezilla나 PuTTY를 사용하지 않고 SFTP에 연결할 수 없습니다(client_loop: 연결 끊김 전송: 깨진 파이프).

오늘 아침에는 모든 것이 제대로 작동했지만 SFTP 사용자와 관련된 문제가 발생했을 수 있습니다. FileZilla에서는 Virtualbox VM에서 파일을 다운로드할 수 없어서 FileZilla 클라이언트를 다시 시작하기로 결정했지만 다시 연결할 수 없었습니다.

내 구성은 다음과 같습니다./etc/ssh/sshd_config:

Subsystem       sftp    /usr/lib/openssh/sftp-server

Match group sftp
ChrootDirectory /var/www
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

FileZilla 출력:

Status: Connecting to 127.0.0.1...
Status: Using username "sftpuser". 
Command:    Pass: **********
Error:  Could not connect to server
Status: Waiting to retry...
Status: Connecting to 127.0.0.1...
Response:   fzSftp started, protocol_version=11
Command:    open "[email protected]" 22
Status: Using username "sftpuser". 
Command:    Pass: **********
Error:  Could not connect to server

PuTTY 출력:

$ sftp [email protected]
client_loop: send disconnect: Broken pipe
Connection closed

SSH 출력:

$ ls -lua
total 28
drwxr-xr-x  5 www-data www-data  4096 june  21 00:00 .
drwxr-xr-x 15 root     root      4096 june  21 00:00 ..
drwxr-xr-x 27 www-data www-data 12288 june  21 00:00 foo
drwxrwxr-x 30 www-data www-data  4096 june  21 00:00 bar
drwxrwxr-x 27 www-data www-data  4096 june  21 00:00 baz

다음을 사용하는 SSH 로그저널ctl -u ssh | 꼬리 -n 12:

june 21 00:00:00 developer sshd[14508]: Accepted password for sftpuser from 10.0.2.2 port 54811 ssh2
june 21 00:00:00 developer sshd[14508]: pam_unix(sshd:session): session opened for user sftpuser(uid=1001) by (uid=0)
june 21 00:00:00 developer sshd[14508]: pam_unix(sshd:session): session closed for user sftpuser
june 21 00:00:00 developer sshd[14653]: Accepted password for sftpuser from 10.0.2.2 port 54816 ssh2
june 21 00:00:00 developer sshd[14653]: pam_unix(sshd:session): session opened for user sftpuser(uid=1001) by (uid=0)
june 21 00:00:00 developer sshd[14653]: pam_unix(sshd:session): session closed for user sftpuser
june 21 00:00:00 developer sshd[15041]: Accepted password for sftpuser from 10.0.2.2 port 54817 ssh2
june 21 00:00:00 developer sshd[15041]: pam_unix(sshd:session): session opened for user sftpuser(uid=1001) by (uid=0)
june 21 00:00:00 developer sshd[15041]: pam_unix(sshd:session): session closed for user sftpuser
june 21 00:00:00 developer sshd[15119]: Accepted password for sftpuser from 127.0.0.1 port 54046 ssh2
june 21 00:00:00 developer sshd[15119]: pam_unix(sshd:session): session opened for user sftpuser(uid=1001) by (uid=0)
june 21 00:00:00 developer sshd[15119]: pam_unix(sshd:session): session closed for user sftpuser

권한 문제인 것 같은데 어디를 봐야 할지 모르겠습니다. 어떤 아이디어가 있나요?

편집: 나에게는 분명했기 때문에 언급하지 않았지만 SSH를 사용하여 다른 사용자와 연결하는 것은 PuTTY에서 작동합니다.

감사합니다 !

답변1

새로운 개발 환경을 수행 중인데 동일한 문제가 발생했기 때문에 다른 VM에서 SFTP를 다시 생성하기로 결정했습니다. sftp 사용자의 홈 디렉터리에 좋은 권한을 부여하고 /var/www에 액세스할 수 있는 마운트된 폴더를 만드는 문제를 해결했습니다.

나는 이 튜토리얼을 따랐다:https://gaelbillon.com/create-a-sftp-user-restricted-to-a-var-www-directory-on-ubuntu-debian/ 이 문제가 발생하면 처음부터 다시 시도하는 것이 좋습니다!

관련 정보