可能是由su程序没有“s”权限引起的,还有可能是sudo命令在普通用户下不能使用的情况,一般会有“must be own by uid 0 and have the setuid bit set”的提示,修改方式就是给对用程序加上“s”权限就可以了。
下面直接给出脚本:
#!/bin/bash
chmod u+s /bin/chage
chmod u+s /bin/chfn
chmod u+s /bin/chsh
chmod u+s /bin/crontab
chmod u+s /bin/fusermount
chmod u+s /bin/gpasswd
chmod u+s /bin/mount
chmod u+s /bin/newgrp
chmod u+s /bin/passwd
chmod u+s /bin/ping
chmod u+s /bin/pkexec
chmod u+s /bin/staprun
chmod u+s /bin/su
chmod u+s /bin/sudo
chmod u+s /bin/umount
chown root:stapusr /bin/staprun
chmod u+s /sbin/mount.nfs
chmod u+s /sbin/pam_timestamp_check
chmod u+s /sbin/unix_chkpwd
chmod u+s /sbin/usernetctl
chmod g+s /bin/wall
chmod g+s /bin/write
chown root:tty /bin/wall
chown root:tty /bin/write
chmod g+s /sbin/netreport
chmod g+s /sbin/postdrop
chmod g+s /sbin/postqueue
chown root:postdrop /sbin/postdrop
chown root:postdrop /sbin/postqueue
上面这些基本包含了Centos7中全部需要“s”属性的可执行程序了。