You are not logged in.
Pages: 1
Hello,
i have the problem that i tried to set up some keyboard
shortcuts with custom commands that require root privileges.
I want to be able to execute the command
"sudo pm-suspend" with a key combination.
So I did it the same way I did it on another Ubuntu pc before:
I opened the "/etc/sudoers" file with "sudo visudo" and added the line:
"jonas ALL = NOPASSWD: /usr/sbin/pm-suspend"
But this currently only works if I have previously opened
a terminal and executed some command with "sudo".
On ubuntu this always worked without problems.
Does anyone have an idea how I can fix this ?
To make the key combination work ?
Offline
That should ordinarily work on Debian/Q4OS, did you edit sudoers file correctly, with no typo ?
Offline
This is my "sudoers" file :
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# Allows the user jonas to run the command »sudo pm-suspend« (Bereitschaft) without typing password
jonas ALL = NOPASSWD: /usr/sbin/pm-suspend
#Allows the user jonas to run the command »sudo shutdown now« (Herunterfahren) without typing password
jonas ALL = NOPASSWD: /usr/sbin/shutdown now
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
Offline
I have inserted a small description of the command, as with the other lines, to remind me of their function.
But because of the # this should not be a problem.
Offline
Yes, we can confirm your directive is correct and it doesn't work, as it's overriden with another directive in /etc/sudoers.d/ directory. You only need to place it after that directive, so if you edit sudoers file, just place your directive bellow the "#includedir /etc/sudoers.d" line. Another way would be to place your directive in a custom file, for example: "/etc/sudoers.d/99-my-directives"
Offline
Pages: 1