You are not logged in.
Pages: 1
Hi,
my user is in 'wheel' group and its enabled like this in /etc/sudoers:
%wheel ALL=(ALL) NOPASSWD: ALLSo no password prompt when using 'sudo echo test'.
But when i use 'sudo -g no-internet echo test' it asks for password again. Why?
This is my '/etc/sudoers.d/no-internet' (chmod 640) drop-in:
Defaults editor=/usr/bin/nano, !env_editor
%no-internet ALL=(ALL) NOPASSWD: ALL
myuser ALL=(ALL) NOPASSWD: ALLThe group 'no-internet' has been added by 'groupadd no-internet'. The user spawning 'sudo' is not in that group.
Edit:
I also get this when entering the password. That's wrong as well.
Sorry, user {user} is not allowed to execute '/usr/bin/echo test' as {user}:no-internet on {host}.Injecting the lines directly into '/etc/sudoers' and logging out (or restart) doesn't help either.
Edit2:
I guess its because the specified group (%no-internet) is just a placeholder for its members/users. As the group doesn't hold any users its just placebo here.
Looks like this guy is wrong (he claims to not join the group) even though his link/reference explicitly tells to join the group (or i misunderstand him).
Last edited by Maniaxx (2017-04-11 21:34:34)
sys2064
Offline
what is the output from sudo -l
$ sudo -lOffline
Have you tried
sudo gpasswd -a username wheel UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. -- Doug Gwyn
Offline
what is the output from sudo -l
$ sudo -l
Matching Defaults entries for {user} on {host}:
env_reset, editor=/usr/bin/nano, !env_editor, editor=/usr/bin/nano, !env_editor
User {user} may run the following commands on {host}:
(ALL) NOPASSWD: ALL
(ALL) NOPASSWD: ALL
(ALL : ALL) NOPASSWD: ALLIn the meantime i've added the last line (ALL : ALL) to allow execution for all groups. Otherwise permission is denied to execute anything (from different group). But it didn't help to suppress the password prompt. The trick was to add myself to the group. The linked post above (that confused me) explicitly tells to not join the group. That's wrong.
It works now properly. I can block internet access (without local subnet) app/command-based on-demand with
sudo iptables -A OUTPUT -m owner --gid-owner no-internet ! -d 192.168.0.0/16 -j DROP
sudo -g no-internet YOURCOMMANDAnd thanks for the 'sudo -l'. Didn't know that. ![]()
Have you tried
sudo gpasswd -a username wheel
I'm already member of 'wheel'.
Last edited by Maniaxx (2017-04-11 21:33:03)
sys2064
Offline
And thanks for the 'sudo -l'. Didn't know that.
No worries - it's often helpful since sudoers is read top-down with the last match applying.
Offline
Pages: 1