新需求需要改变 Ubuntu 启动时的登录信息打印,根据搜索到的资料,找到了这里:
luo[~]ssh luo@192.168.100.233
Press ^@ (C-Space) to enter file transfer mode, then ? for help luo@192.168.100.233's password:
Welcome to Linux Mint 18.3 Sylvia (GNU/Linux 4.13.--generic x86_64) * Documentation: https://www.linuxmint.com
Last login: Sat Mar :: from 192.168.100.233
luo[~]tail /etc/update-motd.d/-header
# Franklin Street, Fifth Floor, Boston, MA - USA. [ -r /etc/lsb-release ] && . /etc/lsb-release if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
# Fall back to using the very slow lsb_release utility
DISTRIB_DESCRIPTION=$(lsb_release -s -d)
fi printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
luo[~]cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=18.3
DISTRIB_CODENAME=sylvia
DISTRIB_DESCRIPTION="Linux Mint 18.3 Sylvia"
随后,又对 motd 进行了进一步了解。发现,ubuntu 下执行 motd 的其实是一个叫 updatemotd 的框架,也就是实际打印上面内容的地方。
比如:https://wiki.ubuntu.com/UpdateMotd
版本不一样,动作也有区别,但是,基本就是 motd 的范畴就对了。