我是Lin/VPS的新手,最近用Ubuntu 16租了一个VPS,我从Win10用SSH和Putty登录到它。
只有当我是root用户时,我才能成功地登录SSH &&我的密钥已加载(Pageant)。
但是:
如果我不是root用户和/或没有加载密钥,我仍然可以使用任何用户名和密码登录(包括root!)。
你们这些家伙很清楚这里的安全漏洞以及这种情况的疯狂。我无法解释,就像当我的私钥加载时以root身份登录时--我可以很好地登录SSH,而无需填写密码。
你能解释一下这怎么可能吗?
发布于 2016-10-22 02:46:13
你能解释一下这怎么可能吗?
有两个有效的配置将允许root使用密码登录:
PermitRootLogin yesPermitRootLogin without-password和ChallengeResponseAuthentication yes及某些PAM配置我似乎还记得Ubuntu的默认值是PermitRootLogin no,但我认为Linode是一种提供远程服务器的服务,最初只有一个root帐户,它已经将构建中的默认设置调整为用户可以直接登录而无需使用lish或其他远程控制台选项(这可能有点不可思议)。我实际上运行了一个Ubuntu16Linode,但是我的sshd_config在安装之后就被修改了,这是我一直在调整的一个设置,所以我无法告诉您它是如何发布的:)
引用sshd_config手册页:
PermitRootLogin
Specifies whether root can log in using ssh(1). The argument
must be ``yes'', ``prohibit-password'', ``without-password'',
``forced-commands-only'', or ``no''. The default is ``no''.
Note that if ChallengeResponseAuthentication is ``yes'', the root
user may be allowed in with its password even if PermitRootLogin
is set to ``without-password''.
If this option is set to ``prohibit-password'' or
``without-password'', password and keyboard-interactive
authentication are disabled for root.引用我的Ubuntu 16系统上的sshd_config:
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes您可能想要阅读如何在Linux上优化SSH守护进程配置,虽然它没有涉及到这个特定的问题,但它是一个很好的可读性调查,说明您可以对sshd_config做些什么。
发布于 2016-10-22 02:54:51
在ssh服务器上运行以下openssh客户端命令,并提供所需的任何选项(希望具有较高的端口号)(如果需要,甚至可以在本地对面向公共的IP执行此操作):
ssh -o PreferredAuthentications=none
部分输出将显示SSH服务器允许的身份验证选项,并可能包含如下文本:(公钥,密码)
这听起来好像你已经设置了无密码登录,通过共享密钥为根帐户,但没有为其他帐户。您可以同时使用公钥和密码身份验证选项,尽管这可能不是您想要做的。如果不是您想要的,您只需要根据您的需要重新配置ssh守护进程。
https://security.stackexchange.com/questions/140500
复制相似问题