在Ubuntu上更改SSH欢迎横幅

时间:2020-01-09 10:44:41  来源:igfitidea点击:

每次我通过ssh客户端连接到Ubuntu开发服务器时,都会收到相同的消息,并且我讨厌看到它,因此决定将消息更改为其他内容。

这是我每次收到的消息:

Linux superfast 2.6.20-16-generic #2 SMP Thu Jun 7 19:00:28 UTC 2007 x86_64
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright. 
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
Last login: Mon Aug 13 01:05:46 2007 from ipaddress removed
data@superfast:~$

更改此消息需要编辑两个不同的文件。可以通过编辑以下文件来修改前三个部分:

/etc/motd

该文件包含linux内部版本号以及Ubuntu保修消息。我觉得这并不是特别有用,因此我删除了所有内容,并用自己的信息替换了它。

要禁用上一次登录消息(我不建议这样做),我们将需要在sudo模式下编辑以下文件:

/etc/ssh/sshd_config

在文件中找到此行,然后将yes更改为no,如下所示:

PrintLastLog no

现在,当我们登录时,我们会得到一个空白提示,尽管我不一定会推荐它,因为出于安全原因,最后一次登录系统很有用。现在是我的提示:

This is a superfast system. Please max out the cpu accordingly. 
Last login: Mon Aug 13 01:24:14 2007 from ipaddress removed
data@superfast:~$