众所周知,我们可以在/ etc / motd或文件/etc/issue.net中键入横幅
所以每一个login到Linux机器的用户都会得到这个标题信息
ssh 10.34.33.23 Red Hat Enterprise Linux Server release 6.8 (Santiago) Kernel \r on an \m ########################################################################## # Welcome to OBAMA house !!! # All connections are monitored and recorded # Disconnect IMMEDIATELY if you are not an authorized user! # ##########################################################################
问题是当我们执行ssh到Linux机器的横幅也显示出来
我们可以通过使用标志-q简单地忽略ssh中的标题 ,如下所示:
ssh -q 192.19.23.45 ls /hillary_emails
实际上我们有更多的〜100 bash和Perl脚本,使用ssh,
所以如果我们为所有机器添加横幅,我们还需要更改使用ssh命令的脚本,并添加标志“ -q ”(静音模式)
但我们宁愿不编辑脚本,因为一些内部问题
所以我问这个
是否有可能改变Linux客户端的configuration方式,横幅只有当用户login到机器时才会显示
但不是从SSH ?
您可以创build一个组,并将相关用户添加到该组中:
groupadd nobanner usermod -a -G nobanner username
然后,您可以编辑/ etc / ssh / sshd_config并添加以下内容:
Match Group nobanner banner "none"
然后,重新启动sshd并testing它。
Match Introduces a conditional block. If all of the criteria on the Match line are satisfied, the keywords on the following lines override those set in the global section of the config file, until either another Match line or the end of the file. The arguments to Match are one or more criteria-pattern pairs. The available criteria are User, Group, Host, and Address. The match patterns may consist of single entries or comma-separated lists and may use the wildcard and negation operators described in the PATTERNS section of ssh_config(5).
我认为SSHD选项PrintMotd no不能帮助你。 将其添加到/ etc / ssh / sshd_config中。 该文件说:
PrintMotd Specifies whether sshd(8) should print /etc/motd when a user logs in interactively. (On some systems it is also printed by the shell, /etc/profile, or equivalent.) The default is “yes”.