我想编辑Last login:与当天消息一起打印出来的信息,但我找不到生成和回显的脚本。
它在哪里定义,在易于编辑的 shell 脚本中,还是在二进制文件中关闭?
请注意,这与ServerFault不同:如何在 ssh 启动时编辑欢迎消息?. “上次登录”信息不是从内部打印出来的/etc/update-motd.d/,而是通过设置PrintLastLog标志来定义的,因此不能像当天消息的其他部分一样进行编辑。
我可以将 shell 命令放在/etc/motd登录横幅文件中吗?我试过了:
$(uptime)
Run Code Online (Sandbox Code Playgroud)
和
`uptime`
Run Code Online (Sandbox Code Playgroud)
这可能吗?
每次我通过 SSH 连接到我的 AWS Ubuntu 服务器时,我都会看到一条系统信息消息,显示负载、内存使用情况和可供安装的软件包,如下所示:
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.2.0-51-virtual x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Sun Nov 10 18:06:43 EST 2013
System load: 0.08 Processes: 127
Usage of /: 4.9% of 98.43GB Users logged in: 1
Memory usage: 69% IP address for eth0: 10.236.136.233
Swap usage: 100%
Graph this data and manage this system at https://landscape.canonical.com/
13 packages can be updated.
0 updates are security updates.
Get cloud support with Ubuntu Advantage Cloud Guest …Run Code Online (Sandbox Code Playgroud) 我想更改在 TTY 上登录计算机时显示的 MOTD,这似乎有效,但不知何故,它不仅在/etc/motd和 中显示 MOTD /etc/update-motd.d/,而且还显示另一条消息。
这在我登录到我的服务器时显示:
sam@laptop:~$ ssh <user>@<server>
Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 2.6.32-042stab068.8 i686)
* Documentation: https://help.ubuntu.com/
No mail.
Last login: Thu Feb 21 19:20:55 2013 from <ip>
Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 2.6.32-042stab068.8 i686)
* Documentation: https://help.ubuntu.com/
<user>@<server>:~$
Run Code Online (Sandbox Code Playgroud)
我的update-motd.d包含两个文件,00-header和10-help-text.
00-header 包含以下内容:
[ -r /etc/lsb-release ] && . /etc/lsb-release
if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
# Fall back to using …Run Code Online (Sandbox Code Playgroud) 每当我通过 SSH 登录 RHEL8 服务器时,都会打印以下行:
Web console: https://<myserver>:9090/ or https://<myip>:9090/
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register
Run Code Online (Sandbox Code Playgroud)
如何禁用这些提示?
任何人都知道要删除哪些包以 git 摆脱 Ubuntu 18.04 上的所有登录信息?
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-52-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
* MicroK8s 1.15 is out! It has already been installed on more
than 14 different distros. Guess which ones?
https://snapcraft.io/microk8s
Run Code Online (Sandbox Code Playgroud)
我认为它可能是update-motd包,但发布后apt purge update-motd仍然有文件/目录留在/etc/. dpkg -S报告这些文件属于base-files我可能不想清除的包。
# find /etc/ | grep motd
/etc/motd
/etc/systemd/system/timers.target.wants/motd-news.timer
/etc/update-motd.d
/etc/update-motd.d/10-help-text
/etc/update-motd.d/97-overlayroot
/etc/update-motd.d/50-motd-news
/etc/update-motd.d/00-header
/etc/default/motd-news
# dpkg -S /etc/update-motd.d/10-help-text
base-files: /etc/update-motd.d/10-help-text
Run Code Online (Sandbox Code Playgroud)
过去我只是通过强力删除文件来解决这个问题,但想知道是否有更好的方法来做到这一点。最好是我也可以轻松地ansible编写成剧本的东西。