加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 如何仅向特定脚本文件授予sudo权限?

发布时间:2020-12-13 18:02:41 所属栏目:Linux 来源:网络整理
导读:我希望用户在特定目录(在我的情况下,/usr/local / tomcat7 / bin)下的某些 shell脚本中拥有sudo权限(无需密码检查),并且无处可去.实现这一目标的最简单方法是什么? / etc / sudoers中的这样的东西似乎不起作用: jsmith ALL=(ALL) NOPASSWD: /usr/local/tom
我希望用户在特定目录(在我的情况下,/usr/local / tomcat7 / bin)下的某些 shell脚本中拥有sudo权限(无需密码检查),并且无处可去.实现这一目标的最简单方法是什么?

/ etc / sudoers中的这样的东西似乎不起作用:

jsmith ALL=(ALL) NOPASSWD: /usr/local/tomcat7/bin

解决方法

我想你差不多了.把/放在目录规范的末尾
jsmith ALL=(ALL) NOPASSWD: /usr/local/tomcat7/bin/

来自sudoers手册页

A directory is a fully qualified path name ending in a ‘/’. When you specify a directory in a Cmnd_List,the user will be able to run any file within that directory (but not in any subdirectories therein).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读