普通用户使用su无法切到root用户的解决方法

可能是由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”属性的可执行程序了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

高晓伟_Steven

相逢即是有缘,动力源于金钱。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值