Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
202
rated 0 times [  202] [ 0]  / answers: 1 / hits: 149378  / 1 Year ago, thu, april 20, 2023, 1:39:07

I have a NOPASSWD line in /etc/sudoers (edited with visudo)



gatoatigrado    ALL=(ALL) NOPASSWD: /bin/set-slow-cpufreq


However, the output is,



gatoatigrado@coral:~> sudo -n /bin/set-slow-cpufreq
sudo: sorry, a password is required to run sudo


This kind of command works on an OpenSuSE machine, but not on Ubuntu 11.10. What am I doing wrong?



Note: I cannot find any relevant system log messages, e.g. via tail -f /var/log/syslog.



edit



Here is /etc/sudoers.



Defaults    env_reset

# things I've tried copying from an opensuse machine
Defaults always_set_home
Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE"

root ALL=(ALL:ALL) ALL
gatoatigrado ALL=NOPASSWD: /bin/set-slow-cpufreq
%admin ALL=(ALL) ALL
%sudo ALL=(ALL:ALL) ALL

More From » sudo

 Answers
2

You should put that line after the line with the rule for the sudo group, because, as the sudoers man page states:



   When multiple entries match for a user, they are applied in order.
Where there are multiple matches, the last match is used (which is not
necessarily the most specific match).

[#40656] Saturday, April 22, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zombieptu

Total Points: 490
Total Questions: 121
Total Answers: 108

Location: Nepal
Member since Mon, Jan 4, 2021
3 Years ago
zombieptu questions
Sat, Feb 18, 23, 20:00, 1 Year ago
Sun, Feb 27, 22, 02:41, 2 Years ago
Sat, Oct 30, 21, 00:00, 3 Years ago
;