我以root修改/etc/sudoers,添加一用户,使其获得sudo权限,但是我要禁止该用户使用useradd/adduser命令
即在/etc/sudoers添加:[用户名] ALL=(ALL) ALL,!/usr/sbin/adduser,!/usr/sbin/adduser
但是我发现该用户可以使用sudo修改/etc/sudoers,使得上述限制失效,请问如何禁止sudo用户修改/etc/sudoers
请问如何禁止sudo用户修改/etc/sudoers的问题?
-
- 帖子: 1
- 注册时间: 2015-03-06 14:26
- 系统: Ubuntu
- vickycq
- 帖子: 4507
- 注册时间: 2011-03-20 13:12
- 系统: Debian
- 来自: 山东省寿光县
- 联系:
Re: 请问如何禁止sudo用户修改/etc/sudoers的问题?
代码: 全选
[用户名] ALL=(ALL) ALL
参考:
http://www.unix.com/unix-for-advanced-a ... mands.html
http://askubuntu.com/questions/500679/b ... -sudo-user
http://serverfault.com/questions/308198 ... doers-file
http://blog.siphos.be/2013/12/limiting- ... nux-alone/
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
欢迎所有 Debian GNU/Linux 用户
-
- 论坛版主
- 帖子: 18279
- 注册时间: 2009-08-04 16:33
Re: 请问如何禁止sudo用户修改/etc/sudoers的问题?
sudo cat /etc/sudoers我以root修改/etc/sudoers,添加一用户,使其获得sudo权限
#
# 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
-
- 论坛版主
- 帖子: 5230
- 注册时间: 2007-01-14 16:23
Re: 请问如何禁止sudo用户修改/etc/sudoers的问题?
可是人的问题是如何避免修改,而不是可不可以直接修改poloshiao 写了:sudo cat /etc/sudoers我以root修改/etc/sudoers,添加一用户,使其获得sudo权限
#
# 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
#include <stdio.h>
void main()
{
double world;
unsigned letter;
short stay;
long memories;
printf("I miss you.\n");
}
void main()
{
double world;
unsigned letter;
short stay;
long memories;
printf("I miss you.\n");
}
- vickycq
- 帖子: 4507
- 注册时间: 2011-03-20 13:12
- 系统: Debian
- 来自: 山东省寿光县
- 联系:
Re: 请问如何禁止sudo用户修改/etc/sudoers的问题?
-
上次由 vickycq 在 2015-08-19 8:23,总共编辑 1 次。
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
欢迎所有 Debian GNU/Linux 用户
- 自由建客
- 帖子: 13468
- 注册时间: 2008-07-30 23:21
- 系统: Debian stable AMD64
Re: 请问如何禁止sudo用户修改/etc/sudoers的问题?
sudo 是用来设置白名单的,不应该用来设置黑名单。
-
- 论坛版主
- 帖子: 18279
- 注册时间: 2009-08-04 16:33
Re: 请问如何禁止sudo用户修改/etc/sudoers的问题?
我要禁止该用户使用useradd/adduser命令
http://superuser.com/questions/735172/h ... c-commands[用户名] ALL=(ALL) ALL,!/usr/sbin/adduser,!/usr/sbin/adduser
How to prevent sudo users from running specific commands?