chrootとnon-chroot sftpを設定するには?

chrootとnon-chroot sftpを設定するには?

chroot sftpユーザーとchrootではなくsftpユーザーとsshユーザーのみを許可するようにOpensshサーバーを設定しようとしています。私の/etc/ssh/sshd_config(コメントと空白行が削除された)の簡単なバージョンは次のとおりです。

Port 22
Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
UsePrivilegeSeparation yes
KeyRegenerationInterval 3600
ServerKeyBits 768
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
AcceptEnv LANG LC_*
#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp intenal-sftp
UsePAM yes
Match Group sftpusers
        ChrootDirectory /var/sftp/%u
        ForceCommand internal-sftp

私がこの仕事を通して得たもの:

  • sftupsersグループのユーザーはファイルをディレクトリにSFTPできますが、ログインすることはできません。ご確認ください。
  • sftpusersに属していないユーザーはSSH経由でログインできます。確認してください。
  • sfttpusersにないユーザーは、次のことができます。いいえsftpファイル。こんな。

Subsystem sftp-lineをコメントアウトされたバージョンに変更すると、「権限のある」ユーザーはsftpとsshを使用できますが、chrootユーザーはsftpを使用できなくなります。

上記の設定ファイルを使用すると、Connection closed by server with exitcode 127FileZillaとpsftpからFatal: Received unexpected end-of-file from SFTP serverエラーメッセージが表示されます。

この問題を解決する方法を知っていますか?

ベストアンサー1

Subsystem sftp intenal-sftp

「内部」でなければなりません。アル字型ナル」。

おすすめ記事