当我登录到 TTY 时,我收到以下友好的文本:
Ubuntu 16.04.03 LTS
Log-in: username
Password:
Last log-in date/time
Welcome to Ubuntu 16.04.03 LTS
* Documentation:
* Management:
* Support:
9 packages to update
4 updates are security updates
我希望每次为adm
组中的所有用户打开 GUI 终端时都重复最后两行(但每次为所有用户打开 GUI 终端时都会显示整个内容)
我尝试了显而易见的方法:
fab-root@fab-ux-predator:~
$ cd /etc/update-motd.d/
fab-root@fab-ux-predator:/etc/update-motd.d
$ ./90-updates-available
fab-root@fab-ux-predator:/etc/update-motd.d
$ cat /var/lib/update-notifier/updates-available
cat: /var/lib/update-notifier/updates-available: Permission denied
fab-root@fab-ux-predator:/etc/update-motd.d
$
我错过了什么?
PS 显然我可以使用chmod o+r
该文件,但是它的未来安全性如何?
答案1
虽然有点慢,但它会生成包/更新信息。将其附加到用户.bashrc
文件:
/usr/lib/update-notifier/apt-check --human-readable
答案2
整个输出位于/run/motd.dynamic
:
$ grep motd /etc/pam.d -R
/etc/pam.d/sshd:# This includes a dynamically generated part from /run/motd.dynamic
/etc/pam.d/sshd:# and a static (admin-editable) part from /etc/motd.
/etc/pam.d/sshd:session optional pam_motd.so motd=/run/motd.dynamic
/etc/pam.d/sshd:session optional pam_motd.so noupdate
/etc/pam.d/login:# This includes a dynamically generated part from /run/motd.dynamic
/etc/pam.d/login:# and a static (admin-editable) part from /etc/motd.
/etc/pam.d/login:session optional pam_motd.so motd=/run/motd.dynamic
/etc/pam.d/login:session optional pam_motd.so noupdate
因此,在您的中.bashrc
,您可以添加:
[[ -r /run/motd.dynamic ]] && cat /run/motd.dynamic
或者:
[[ -r /run/motd.dynamic ]] && grep update /run/motd.dynamic