sshd_config文件中“无密码”是什么意思?

我刚刚在我的服务器上安装了Ubuntu 14.04,当我在sshd_config文件中遇到这个时,我正在设置所有的配置文件:

 # Authentication: LoginGraceTime 120 PermitRootLogin without-password StrictModes yes 

这让我非常担心。 我认为有人可能没有密码就以root身份登录我的服务器。

我尝试通过以下方式连接到我的服务器:

 johns-mbp:~ john$ ssh root@192.168.1.48 The authenticity of host '192.168.1.48 (192.168.1.48)' can't be established. RSA key fingerprint is 40:7e:28:f1:a8:36:28:da:eb:6f:d2:d0:3f:4b:4b:fe. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.1.48' (RSA) to the list of known hosts. root@192.168.1.48's password: 

我输入了一个空密码,它没有让我进去,这是一种解脱。 所以我的问题是:没有密码是什么意思,为什么这是Ubuntu 14.04中的默认值?

从联机帮助页 :

的PermitRootLogin

指定root是否可以使用ssh (1)登录。 参数必须为“yes”,“without-password”,“forced-commands-only”或“no”。默认值为“yes”。

如果此选项设置为“without-password”,则对root禁用密码身份validation。

如果此选项设置为“forced-commands-only”,则允许使用公钥认证的root登录,但仅当指定了command选项时(即使通常不允许root登录,这对于进行远程备份也很有用) )。 root的所有其他身份validation方法都被禁用。

如果此选项设置为“no”,则不允许root用户登录。

因此, without-password只允许root登录使用公钥认证。 这通常与shell脚本和自动化任务一起使用。

实际上,如果您使用PAM身份validation,此设置几乎没有任何作用。 在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'. 

Ubuntu的默认设置是使用PAM身份validation:

 UsePAM yes 

请注意,有正当理由通过root登录(但使用加密密钥而不是密码)。 一个典型的例子是远程同步两个服务器(将其中一个用作故障转移)。 由于结构必须相同,因此通常需要root密码。

以下是使用unison进行同步的示例: https : //serverfault.com/questions/341985/remotely-use-root-over-ssh-for-unison

在较新版本的sshd中,“无密码”已更改为“禁止密码”。

两个版本的工作,如果可以的话,最好使用“禁止密码”:它更好地解释了自己。