给用户授权以root身份执行ls,touch,passwd命令,但是禁止修改root用户密码
程序员文章站
2022-07-14 19:57:37
...
通过visudo修改授权oldboy相关的权限
通过visudo修改授权oldboy相关的权限
[[email protected] ~]# visudo
oldboy ALL=(ALL) /bin/ls, /bin/touch, /usr/bin/passwd, !/usr/bin/passwd root
登录oldboy,并试验结果
登录oldboy,并试验结果
[[email protected] ~]# su - oldboy
[[email protected] ~]$ sudo passwd lin666
Changing password for user lin666.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[[email protected] ~]$ sudo passwd root
[sudo] password for oldboy:
Sorry, user oldboy is not allowed to execute '/usr/bin/passwd root' as root on lin.
上一篇: hive小文件优化
下一篇: 第3章 第3节 闭包