[英]how to only allow sudo on specify path?
in Linux: 在Linux中:
I want to limited user only can do sudo on specify path. 我想限制用户只能在指定路径上执行sudo。
sudo chmod works on /home/Krome/revA sudo chmod适用于/ home / Krome / revA
but sudo chmod failed on /home/Krome 但是sudo chmod在/ home / Krome上失败
Thanks! 谢谢!
可以使用chroot
将用户或进程限制为某个路径-这里的问题是,在chroot
之后, $PATH
和动态加载的对象中的命令将不再可访问,因此您需要一个静态链接的shell来执行chroot
以及用户应能够发出的内置命令。
I don't think it possible, and am pretty sure it's not reasonable. 我认为这是不可能的,并且非常确定这是不合理的。
chmod
would work inside /home/Krome
if it's the user's home folder. 如果是用户的home文件夹,则
chmod
可以在/home/Krome
内部运行。
I think you need a regular user (without sudo
), and everything else can be managed by adding that user to groups and sharing some folders to those groups. 我认为您需要一个普通用户(没有
sudo
),并且可以通过将该用户添加到组中并在这些组中共享一些文件夹来管理其他所有内容。
Add to /etc/sudoers
something like the following line: 将类似以下行的内容添加到
/etc/sudoers
:
%users ALL = NOPASSWD: /bin/chmod [ugoa][-+=][rwxXst] /home/Krome/*
It basically says that all group users
members can invoke sudo chmod
in symbolic mode on anything under /home/Krome/
path. 它基本上说所有组
users
成员都可以在/home/Krome/
路径下的任何内容上以符号模式调用sudo chmod
。
See man sudo
for more details. 有关更多详细信息,请参见
man sudo
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.