如何为给定用户禁用/修改SSH登录标语?


Answers:



13

如果要为所有ssh用户禁用该消息,请编辑/etc/pam.d/sshd并注释掉这些行

session    optional     pam_motd.so  motd=/run/motd.dynamic noupdate
session    optional     pam_motd.so # [1]

适用于Ubuntu 14.04-
最高

12

/etc/ssh/sshd_config确保有一行:

PrintMotd no

如果将其设置为“是”,则将其更改为“否”。

通过键入重新启动SSH服务器

service ssh restart

您应该从那里出发。


+1您的解决方案很棒,因为它保留了上次登录名,但隐藏了其余登录名。
Brian Graham

1
似乎不起作用。至少不在14.04中。矿井已经摆好"no",但欢迎问候仍在显示。有所帮助的是更新/etc/pam.d/sshd
oᴉɹǝɥɔ

@cherio,我可以确认同样适用于我。使用LTS 14.04
Ace

不再适用于14.04,请参阅@cweiske的答案,因为它确实适用于14.04。
ecnepsnai

不适用于16.04
TheFiddlerWins'Aug

3

.hushlogin没对我有用(在Debian 7上),但是将Banner设置为/dev/nullin /etc/ssh/sshd_config

#Banner /etc/issue.net
Banner /dev/null

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.