Hi,
I would like to stop a service as user martin without having to enter the password each time.
For this I have entered the following line in the file /etc/sudoers:
martin ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop vdr.service
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
vdr ALL=(ALL) NOPASSWD: /usr/bin/markad
martin ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop vdr.service
## Allows members of the 'sys' group to run networking, software,
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
## Allows members of the users group to mount and unmount the
## cdrom as root
# %users ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom
## Allows members of the users group to shutdown this system
# %users localhost=/sbin/shutdown -h now
## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
the user martin may run the following commands:
[martin@fc36 vdr]$ sudo -l -U martin
Matching Defaults entries for martin on fc36:
!visiblepw, always_set_home, match_group_by_gid, always_query_group_plugin, env_reset, env_keep="COLORS DISPLAY HOSTNAME HISTSIZE KDEDIR LS_COLORS", env_keep+="MAIL QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE", env_keep+="LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES", env_keep+="LC_MONETARY LC_NAME
LC_NUMERIC LC_PAPER LC_TELEPHONE", env_keep+="LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY", secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/var/lib/snapd/snap/bin
User martin may run the following commands on fc36:
(ALL) NOPASSWD: /usr/bin/systemctl stop vdr.service
(ALL) ALL
but when I want to stop the service I am asked to enter the password.
[martin@fc36 vdr]$ systemctl stop vdr
Failed to stop vdr.service: Access denied
See system logs and 'systemctl status vdr.service' for details.
How can i solve this ?
Regards
Martin