为了提高 Ubuntu 20.04 服务器的安全性,我按照本文禁用了 pw 登录:https://www.cyberciti.biz/faq/how-to-disable-ssh-password-login-on-linux/
它可以工作,但是 SSH 登录时 sysinfo 不再显示:
% ssh server
Last login: Sun Mar 6 21:07:05 2022 from 77.2.170.244
包括的步骤包括:
$ sudo vi /etc/ssh/sshd_config
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no
PermitRootLogin no
PermitRootLogin prohibit-password
我如何重新启用 Landscape-sysinfo?
答案1
一只手拿走的东西,另一只手可以回馈给你:
UsePAM no
禁用通常由 PAM 处理的所有操作。这包括以下配置
/etc/pam.d/sshd
:# Print the message of the day upon successful login. # This includes a dynamically generated part from /run/motd.dynamic # and a static (admin-editable) part from /etc/motd. session optional pam_motd.so motd=/run/motd.dynamic session optional pam_motd.so noupdate
可以使用以下命令重新启用其中的一部分
PrintMotd yes
:/etc/motd
指定当用户以交互方式登录时, sshd(8) 是否应打印。(在某些系统上,它也由 shell/etc/profile
、 或等效程序打印。)默认值为 yes。no
此选项专门在设置了 的系统上设置UsePAM yes
(例如 Debian 或 Ubuntu),以避免双重动态登录时。可以重新启用。不会有动态部分(除其他内容外,可能会显示可升级的软件包数量)。
因此您应该改变配置以便也能拥有PrintMotd yes
。