sshd_config 重启后自动更改规则

Bre*_*the 3 amazon-ec2 sshd centos7

在 AWS/EC2 上的不同机器上,我在重新启动机器后不断更改 sshd 规则

原始规则:

Match Group sftpusers
        ChrootDirectory /data/sftp/%u
        ForceCommand internal-sftp
        PasswordAuthentication yes
Run Code Online (Sandbox Code Playgroud)

重启后修改规则:

Match Group sftpusers
ChrootDirectory /data/sftp/%u
ForceCommand internal-sftp
PasswordAuthentication no
Run Code Online (Sandbox Code Playgroud)

所以基本上,这个组的用户无法认证sftp连接,真的很烦人。

注意:默认情况下,PasswordAuthentication 设置为 No。我只允许这组用户使用

好主意?

hel*_*loV 6

检查你有/etc/cloud/cloud.cfg或类似的文件。我不确定它在 CentOS 中叫什么。查找ssh_pwauth参数。

如果设置为 0,则表示将禁用密码验证(通过 sshd_config)。将其设置为 1 并尝试。