Wir*_*rap 6 ssh email bash motd
在运行 Ubuntu 14.04 的服务器上,我You have new mail
每次通过 SSH 登录时都会在 motd 中看到。
问:这是谁告诉我的?
邮件没有找到任何东西,我不希望这台服务器上有任何邮件。
“我”和“根”的 crontab 包含MAILTO=""
.
文本You have new mail
不在/etc/motd
或 中/var/run/motd
。
我希望一些命令是相关的:
me@AtomServer:~$mail
No mail for me
me@AtomServer:~$sudo mail
No mail for root
me@AtomServer:~$sudo ls -l /var/mail
total 8
-rw------- 1 la mail 1 Jul 15 22:12 me
-rw------- 1 root mail 1 Jul 27 19:59 root
me@AtomServer:~$
me@AtomServer:~$grep '^s.*motd' /etc/pam.d/sshd
session optional pam_motd.so # [1]
me@AtomServer:~$$ls -la /etc/update-motd.d
total 48
drwxr-xr-x 2 root root 4096 May 13 13:38 .
drwxr-xr-x 127 root root 12288 Jul 27 20:06 ..
-rwxr-xr-x 1 root root 1220 Apr 19 2012 00-header
-rwxr-xr-x 1 root root 1358 Apr 19 2012 10-help-text
lrwxrwxrwx 1 root root 46 Jan 30 21:57 50-landscape-sysinfo -> /usr/share/landscape/landscape-sysinfo.wrapper
-rwxr-xr-x 1 root root 149 Aug 22 2011 90-updates-available
-rwxr-xr-x 1 root root 129 Sep 30 2011 91-release-upgrade
-rwxr-xr-x 1 root root 129 Jun 16 2014 95-hwe-eol
-rwxr-xr-x 1 root root 142 Aug 22 2011 98-fsck-at-reboot
-rwxr-xr-x 1 root root 144 Aug 22 2011 98-reboot-required
-rwxr-xr-x 1 root root 1158 Apr 19 2012 99-footer
me@AtomServer:~$
me@AtomServer:/etc/update-motd.d$grep -ri 'mail' *
me@AtomServer:/etc/update-motd.d$
Run Code Online (Sandbox Code Playgroud)
/etc/motd.tail
不存在。
嗯,这是由你的 shell 自己完成的。显然它正在监视MAIL
(或MAILPATH
)环境变量指向的文件(或目录)。
这记录在man bash
:
MAIL
If this parameter is set to a file or directory name and
the MAILPATH variable is not set, bash informs the user of the arrival
of mail in the specified file or Maildir-format directory
Run Code Online (Sandbox Code Playgroud)
另一方面, 的内容motd
实际上由 PAM 模块管理pam_motd
(根据用户配置文件,shell 可能需要添加一些内容)。
默认情况下,pam_motd
显示/etc/motd
文件的静态内容以及在/etc/update-motd.d
目录中运行脚本生成的动态输出(使用run-parts
)。
归档时间: |
|
查看次数: |
3244 次 |
最近记录: |