跳转到主内容
新派编程网 - 新潮编程理念,全新技术课堂!

如何解决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
解决方法非常简单: CentOS Linux 7.9.2009 CentOS Linux 7.9.2009是传统CentOS Linux 7的最后主要版本,也是很多企业历史服务器中仍可能遇到的系统版本。它以稳定、兼容RHEL 7生态、文档丰富和软件支持广泛著称,曾长期用于Web服务、数据库、虚拟化节点和企业内部业务系统。不过CentOS Linux 7已于2024年6月30日停止维护,现在继续使用会面临安全补丁缺失风险。该版本更适合旧业务迁移、历史环境恢复或离线兼容性测试。 下载
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 进行查看。

相关文章