我的 CentOS 机器上有 root 和另一个用户。对于其他用户,我可以使用 sudo 来执行大部分管理任务。现在,我想从这个用户那里获得这个特权,这样它就不能再使用 sudo 了。
有谁知道如何实现它?
最佳答案
在 Centos 上实现这一目标的一种方法是执行以下两个步骤:
(您不想要任何 sudo 权限的那个)来自
/etc/sudoers
文件或(如果存在)从下的任何文件/etc/sudoers.d
小路。 /etc/group
中的轮组中删除。 . e.g.:
- For user centos
sudo vim /etc/sudoers
orsudo vim /etc/sudoers.d/90-cloud-init-users
and remove or comment something likecentos ALL=(ALL) NOPASSWD:ALL
(save and quit afterwards).- Then
sudo vim /etc/group
and change the linewheel:x:10:centos
towheel:x:10:
(save and quit afterwards).- (Optional) Finally
sudo reboot
.
希望有帮助!
关于centos - 如何在 CentOS 7 中删除用户的 sudo 权限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62325382/