s权限位引发postfix及crontab异常处理

一、问题现象

业务反馈某台应用服务器,普通用户使用mutt程序发送邮件时,提示“postdrop warning: mail_queue_enter: create file maildrop/713410.6065: Permission denied”,而且普通用法使用crontab -e 编辑自身任务计划时,也会提示“ crontab: edits left in /tmp/crontab.XXXXCl0bLz” 。

二、问题分析与解决

1、postdrop异常问题

使用postfix check命令检测发现有如下报错:

postfix/postfix-script: warning: not set-gid or not owner+group+world executable: /usr/sbin/postqueue
postfix/postfix-script: warning: not set-gid or not owner+group+world executable: /usr/sbin/postdrop 

上面的提示其实已经非常清楚了,在这两个可执行文件的组权限中,没有s权限位。慎重起见,不审找了一台主机对比下,发现确实不存在s权限,正常的权限如下:

# ll /usr/sbin/postqueue
-rwxr-sr-x. 1 root postdrop 259992 Jan 27  2014 /usr/sbin/postqueue

解决方法非常简单:

chmod g+s /usr/sbin/postqueue
chmod g+s /usr/sbin/postdrop
postfix reload 

2、crontab普通用户无法编辑问题

使用crontab -e发现可以正常查看,但是编辑完,保存时提示“ crontab: edits left in /tmp/crontab.XXXXCl0bLz” 。即然上面第一个问题是s权限位引起的,这个问题想必也是,所以未做strace 或审计跟踪,地接查看/usr/bin/crontab权限位,发现和正常主机对比,发现用户权限上少了s权限 ---crontab命令和passwd命令类似,需要用户具有s权限位。执行如下命令后,问题解决:

chmod u+s /usr/bin/crontab
rccron restart

注:这点对比了下SuSE和redhat下的区别,发现user权限下如果没有s权限位。在redhat下提示:

You (test) are not allowed to use this program (crontab)
See crontab(1) for more information

而且直接crontab -l命令查看时,都会提示上面的错误。而在SuSE没有这个s权限,仍然可以正常的通过crontab -l 进行查看。

标签:PostfixCrontab 发布于:2019-11-09 13:40:15