我刚刚在我的服务器上安装了 Ubuntu 14.04,当我在我的sshd_config
文件中遇到这个时,我正在设置我的所有配置文件:
# Authentication:
LoginGraceTime 120
PermitRootLogin without-password
StrictModes yes
Run Code Online (Sandbox Code Playgroud)
这让我非常担心。我认为有人可以在没有密码的情况下以 root 身份登录我的服务器。
我尝试通过以下方式以 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:
Run Code Online (Sandbox Code Playgroud)
我输入了一个空白密码,但它没有让我进入,这让我松了一口气。所以我的问题是:没有密码意味着什么,为什么这是 Ubuntu 14.04 中的默认设置?
Flo*_*sch 161
从联机帮助页:
允许Root登录
指定 root 是否可以使用ssh (1)登录。参数必须是“yes”、“without-password”、“forced-commands-only”或“no”。默认值为“yes”。
如果此选项设置为“without-password”,则对 root 禁用密码验证。
如果此选项设置为“forced-commands-only”,则将允许使用公钥身份验证的 root 登录,但
command
前提是已指定该 选项(即使通常不允许 root 登录,这对于进行远程备份也很有用) . 对 root 禁用所有其他身份验证方法。如果此选项设置为“否”,则不允许 root 登录。
因此without-password
,仅允许使用公钥身份验证进行 root 登录。这通常与 shell 脚本和自动化任务一起使用。
Ata*_*911 18
实际上,如果您使用 PAM 身份验证,则此设置几乎没有任何作用。在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'.
Run Code Online (Sandbox Code Playgroud)
Ubuntu 上的默认设置是使用 PAM 身份验证:
UsePAM yes
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
321557 次 |
最近记录: |