SFTP Chroot Jail 阻止 SSH:此服务仅允许 sftp 连接

SFTP Chroot Jail 阻止 SSH:此服务仅允许 sftp 连接

我成功设置了 SFTP Chroot Jail,但除了 SFTP 之外,我还想让我的用户通过 SSH 进行访问。如果我尝试使用 testuser 进行 SSH 访问,在提供密码后,putty 会关闭。使用 Python 的paramiko模块执行 SSH 连接时,我收到以下消息:

This service allows sftp connections only.

导致此问题的常见原因似乎是系统管理员未对文件ForceCommand internal-sftp中的内容进行注释/etc/ssh/sshd_config。但是,我的/etc/ssh/sshd_config文件如下所示,ForceCommand internal-sftp注释掉了:

Match group jailedusers
    ChrootDirectory /jailed/%u
    #ForceCommand internal-sftp
    AllowTcpForwarding no

当我创建我的测试用户时,我最初将他的 bash 设置为/bin/false,但已将其更改为/bin/bash。如果我 cat/etc/passwd并搜索我的测试用户,我会看到:

testuser:x:573:502::/jailed/testuser:/bin/bash

还有什么原因阻止我与该用户进行 SSH 连接?

相关内容