Linux visudo nopasswd 不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8474830/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 03:36:34 来源:igfitidea点击:
visudo nopasswd not working
提问by DaveB
I am trying to allow all users in the admin group to run a jar
file as SUDO without a password, I have edited the sudoers file (using visudo) and tried a number of commands but it still prompts me for a password every time
我试图允许 admin 组中的所有用户在jar
没有密码的情况下以 SUDO身份运行文件,我已经编辑了 sudoers 文件(使用 visudo)并尝试了许多命令,但它仍然每次都提示我输入密码
Contents of /etc/sudoers
:
内容/etc/sudoers
:
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
# Allow members of group sudo to execute any command
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=(ALL) ALL
#
#includedir /etc/sudoers.d
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
admin ALL=(ALL) NOPASSWD: /opt/myapp/
admin ALL=(ALL) NOPASSWD: /opt/myapp/myapp.jar
admin ALL=(ALL) NOPASSWD: java -jar /opt/myapp/myapp.jar
采纳答案by rodrigo
Try:
尝试:
%admin ALL=(ALL) NOPASSWD: /usr/bin/java -jar /opt/myapp/myapp.jar