Ubuntu 22仍允许root用户SSH登录的问题求助
Ubuntu 22仍允许root用户SSH登录的问题求助
大家好,我碰到个棘手的问题:我在用Ubuntu 22系统,本来想通过配置SSH禁止root用户登录,但实际测试下来还是能通过SSH以root身份登录,想请教下各位大佬哪里出问题了。
我在/etc/ssh/sshd_config里手动添加了这些配置:
PasswordAuthentication no PermitEmptyPasswords no PubkeyAuthentication yes PermitRootLogin no
但后来我仔细查看完整的配置文件内容,发现里面还有一行未被注释的配置:PermitRootLogin without-password,下面是配置文件的关键内容片段:
Include /etc/ssh/sshd_config.d/*.conf #Port 22 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress :: #HostKey /etc/ssh/ssh_host_rsa_key #HostKey /etc/ssh/ssh_host_ecdsa_key #HostKey /etc/ssh/ssh_host_ed25519_key # Ciphers and keying #RekeyLimit default none # Logging #SyslogFacility AUTH #LogLevel INFO # Authentication: #LoginGraceTime 2m PermitRootLogin without-password #StrictModes yes #MaxAuthTries 6 #MaxSessions 10 #PubkeyAuthentication yes # Expect .ssh/authorized_keys2 to be disregarded by default in future. #AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2 #AuthorizedPrincipalsFile none #AuthorizedKeysCommand none #AuthorizedKeysCommandUser nobody # For this to work you will also need host keys i...
我有点困惑,是不是因为配置文件里同时存在PermitRootLogin no和PermitRootLogin without-password导致冲突了?还是说Include引入的其他配置文件里有覆盖设置的内容?有没有大佬能帮我排查下原因?
备注:内容来源于stack exchange,提问作者itinance
相关产品推荐
相关产品推荐

