SSH:只接受来自本地主机的密码连接
问题描述:
我希望能够使用密码连接到root @ localhost,并且只能使用私钥连接到外部(root @ my-ip)。我没有找到在/ etc/ssh/sshd_config中写什么来允许这个...如果它需要一个SSH密钥和一个密码,那也可以。SSH:只接受来自本地主机的密码连接
你有什么想法吗?
答
这取决于你openssh的版本,但在最近的,你可以设置:
PermitRootLogin prohibit-password
Match LocalAddress 127.0.0.1,::1 # localhost
PermitRootLogin yes
或者使用由您的版本(PasswordAuthentication
)支持的其他一些等价的。
它适用于:Match LocalAddress 127.0.0.1,:: 1 :-)谢谢。 –
感谢关于IPv6的说明。我总是忘记:) – Jakuje