当ssh进入服务器时,如何禁用问候语?

时间:2015-07-02 15:16:27

标签: linux ubuntu ssh

每次 - 我ssh进入我的服务器我都会

ssh root@12.34.56.78

Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-52-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Thu Jul  2 10:58:35 EDT 2015

  System load:  0.16               Processes:           90
  Usage of /:   13.5% of 19.56GB   Users logged in:     0
  Memory usage: 25%                IP address for eth0: 12.34.56.78
  Swap usage:   0%                 IP address for eth1: 10.10.10.10

  Graph this data and manage this system at:
    https://landscape.canonical.com/

Last login: Thu Jul  2 10:58:35 2015 from 50-198-81-174-static.hfc.comcastbusiness.net

我第一次登录服务器时可以显示。 但是一直看到这个消息 - 我觉得有点不必要。

有人可以告诉我如何禁用它吗?

2 个答案:

答案 0 :(得分:5)

最理智的解决方案,如果它是您自己的服务器,将禁用SSH守护程序配置中的motd。将PrintMotd中的/etc/ssh/sshd_config设置为no并重新启动ssh守护程序。

或者,您可以尝试touch ~/.hushlogin,这会在您的主文件夹中创建一个空文件。允许远程登录的守护进程传统上检查是否存在此文件,如果存在,它们将允许您安静地登录。

答案 1 :(得分:1)

或者,如果 motd 设置为 no,而您不想使用 .hushlogin,您可以编辑 /etc/motd/etc/update-motd.d/* 并擦除其内容,这样您仍会收到“上次登录”消息的通知。