Which of the following lines in the sshd configuration file should, if present, be changed in order to increase the security of the server? (Choose two.)

A.

Protocol 2, 1

B.

PermitEmptyPasswords no

C.

Port 22

D.

PermitRootLogin yes

E.

IgnoreRhosts yes

题解

「Protocol」可以设置 SSH 服务器支持的 SSH 协定版本(1 或 2),如果有想要支持多个版本的话,就使用逗号「,」隔开。数字的排列顺序并不代表偏好使用的版本顺序。预设为「2」。

「PermitEmptyPasswords」可以设置 SSH 服务器是否允许空密码的用户进行登录,建议设成「no」才安全,默认值也是「no」。

「Port」可以设置 SSH 服务器所监听的 TCP 连接端口。默认值为「22」。

「PermitRootLogin」可以设置 SSH 服务器是否要允许「root」用户的登录。设为「yes」,表示允许;设为「no」,表示不允许;设为「without-password」,表示不允许「root」用户使用密码来登录;设为「forced-commands-only」,表示只允许「root」用户使用 SSH 公钥来登录,且该公钥文件的第一行需加上「command」项目来设置 SSH 登录后要运行的指令。默认值为「prohibit-password」。

「IgnoreRhosts」可以设置 SSH 服务器是否忽略用户家目录下的「.rhosts」和「.shosts」文件来做 Rhosts 授权(RhostsRSAAuthentication 和 HostbasedAuthentication),如果忽略的话,依然会使用「/etc/hosts.equiv」和「/etc/ssh/shosts.equiv」文件。默认值是「yes」。Rhosts 的安全性不高,建议不要使用。

选项 A,为了让 SSH 服务器更安全,就不要使用 SSH 的版本 1,所以当「Protocol 2, 1」出现在 SSH 的设置档中的话,建议将「Protocol」改为「2」,以增加安全性。此为正确答案。

选项 B,此为安全的设置。

选项 C,此不太影响安全性。

选项 D,人们通常认为密码要比 SSH 公钥还要更不安全,因此为了让 SSH 服务器更安全,当「PermitRootLogin yes」出现在 SSH 的设置档中的话,建议将「PermitRootLogin」改为其它设置值。此为正确答案。

选项 E,此为安全的设置。