SFTP 연결 문제

SFTP 연결 문제

여러 CHROOTed 사용자에게 액세스를 제공하기 위해 새로운 debian sftp 서버를 설정했습니다. 추가한 첫 번째 계정은 잘 작동하지만 두 번째 계정은 인증 직후 연결이 끊어집니다.

sftp -v 출력:

debug1: Authentication succeeded (password).
Authenticated to xxx.xxx.xxx.xxx ([xxx.xxx.xxx.xxx]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Connection to xxx.xxx.xxx.xxx closed by remote host.
Transferred: sent 2416, received 1376 bytes, in 0.0 seconds
Bytes per second: sent 279797.8, received 159355.1
debug1: Exit status -1
Couldn't read packet: Connection reset by peer

사용자 구성은 다음과 같습니다.

Match group joseph
        ChrootDirectory /backups/joseph
        x11Forwarding no
        AllowTcpForwarding no
        ForceCommand internal-sftp

CHROOTed 폴더에 대한 rw 권한은 a+rw이며 루트가 소유합니다.

어떤 아이디어가 있나요?

추신 - "Subsystem sftp external-sftp"도 거기에 있다는 점을 추가해야 합니다.

답변1

다음 사용자 및 그룹을 생성하는 동안 일종의 실수를 저지른 것 같습니다.이것편지 안내.

실제로 어떻게 작동합니까?

$useradd <user>
$usermod -d /<folder> -s /bin/false <user>
$chmod 744 /<folder>
  • 사용자에게 자신의 폴더에 대한 읽기/쓰기 권한을 부여합니다.
  • SSH/SFPT 프로토콜을 사용하여 연결이 허용됨
  • /etc/ssh/sshd_config에 각 사용자에 대해 다음을 추가했습니다.

일치 그룹
ChrootDirectory /folder
x11Forwarding no
AllowTcpForwarding no
ForceCommand 내부 sftp

관련 정보