SFTP接続の問題

SFTP接続の問題

複数の CHROOT されたユーザーにアクセスを提供するために、新しい Debian SFTP サーバーをセットアップしました。追加した最初のアカウントは問題なく動作しますが、2 番目のアカウントは認証後すぐに切断されます。

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

CHROOT されたフォルダーの rw 権限は a+rw であり、所有者は root です。

何か案は?

PS - 「Subsystem sftp internal-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 internal-sftp

関連情報