
當我登入 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