分页: 1 / 1
请问如何禁止sudo用户修改/etc/sudoers的问题?
发表于 : 2015-08-18 16:33
由 qyecst
我以root修改/etc/sudoers,添加一用户,使其获得sudo权限,但是我要禁止该用户使用useradd/adduser命令
即在/etc/sudoers添加:[用户名] ALL=(ALL) ALL,!/usr/sbin/adduser,!/usr/sbin/adduser
但是我发现该用户可以使用sudo修改/etc/sudoers,使得上述限制失效,请问如何禁止sudo用户修改/etc/sudoers
Re: 请问如何禁止sudo用户修改/etc/sudoers的问题?
发表于 : 2015-08-18 18:51
由 vickycq
Re: 请问如何禁止sudo用户修改/etc/sudoers的问题?
发表于 : 2015-08-18 20:54
由 poloshiao
我以root修改/etc/sudoers,添加一用户,使其获得sudo权限
sudo cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
/etc/sudoers 檔案前面幾行 已經說明 不要直接修改/etc/sudoers
Re: 请问如何禁止sudo用户修改/etc/sudoers的问题?
发表于 : 2015-08-18 21:42
由 onlylove
poloshiao 写了:我以root修改/etc/sudoers,添加一用户,使其获得sudo权限
sudo cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
/etc/sudoers 檔案前面幾行 已經說明 不要直接修改/etc/sudoers
可是人的问题是如何避免修改,而不是可不可以直接修改
Re: 请问如何禁止sudo用户修改/etc/sudoers的问题?
发表于 : 2015-08-18 23:54
由 vickycq
-
Re: 请问如何禁止sudo用户修改/etc/sudoers的问题?
发表于 : 2015-08-19 0:20
由 自由建客
sudo 是用来设置白名单的,不应该用来设置黑名单。
Re: 请问如何禁止sudo用户修改/etc/sudoers的问题?
发表于 : 2015-08-19 7:23
由 poloshiao
我要禁止该用户使用useradd/adduser命令
[用户名] ALL=(ALL) ALL,!/usr/sbin/adduser,!/usr/sbin/adduser
http://superuser.com/questions/735172/h ... c-commands
How to prevent sudo users from running specific commands?