visudo nopasswd无法正常工作 [英] visudo nopasswd not working

查看:468
本文介绍了visudo nopasswd无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试允许admin组中的所有用户以SUDO身份运行jar文件而不使用密码,我已经编辑了sudoers文件(使用visudo)并尝试了许多命令,但仍然提示我输入每次输入密码

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

/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

推荐答案

尝试:

%admin ALL=(ALL) NOPASSWD: /usr/bin/java -jar /opt/myapp/myapp.jar

这篇关于visudo nopasswd无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆