大网数据广告活动
服务器运维问答

Is PermitRootLogin=prohibit-password still necessary when PasswordAuthentication=no?

· 52CE 我爱测

Our server cluster has remote root access enabled for rescue purposes, and we generally set PermitRootLogin prohibit-password in /etc/ssh/sshd_config because LDAP users can still login using password. Recently we added an extra s…

问题原文

原帖链接 · iBug · CC BY-SA 4.0

Our server cluster has remote root access enabled for rescue purposes, and we generally set PermitRootLogin prohibit-password in /etc/ssh/sshd_config because LDAP users can still login using password.

Recently we added an extra server with very strict access control, and we have PasswordAuthentication set to no so only specific users with SSH keys can login. However, a default setting of PermitRootLogin yes remained for some time unnoticed. (It wasn't a real issue since we also have the password of the root user deleted so no one could log in unless directly at the KVM console.)

My question is, with PasswordAuthentication no set, does PermitRootLogin yes behave identically to prohibit-password?

社区高分解答

原帖链接 · exore · CC BY-SA 4.0

prohibit-password means authenticate with any allowed mechanism that is not password and not keyboardinteractive. See sshd_config PermitRootLogin

PasswordAuthentication no just means authenticate with any allowed mechanism that is not password, obviously. See sshd_config PasswordAuthentication

Therefore, the answer is no.

Also, prohibit-password is specific to the root account, PasswordAuthentication no is a global setting that affects all the accounts.

Note however, if you don't use keyboardinteractive, then the answer is yes (only considering the root account)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-02-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。