ubuntu 登陆信息打印 — motd

新需求需要改变 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.0-36-generic x86_64)

 * Documentation:  https://www.linuxmint.com
Last login: Sat Mar  3 14:09:53 2018 from 192.168.100.233
luo[~]tail /etc/update-motd.d/00-header 
#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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)
" "$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 的范畴就对了。

Published by

风君子

独自遨游何稽首 揭天掀地慰生平