You are not logged in.

#1 2021-09-12 21:19:12

Krygen
Banned
Registered: 2021-09-10
Posts: 39

Sudoers file with wheel NOPASSWD not working.

My /etc/sudoers file

I am trying to use sudo command without entering password, so I changed the sudoers file
by typing 'sudo EDITOR=vim visudo' than uncommented wheel group.Also added my user
to wheel group but when I use sudo command it is still requiring me for a password, need help here.

## sudoers file.
##
## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.
##
## See the sudoers man page for the details on how to write a sudoers file.
##

##
## Host alias specification
##
## Groups of machines. These may include host names (optionally with wildcards),
## IP addresses, network numbers or netgroups.
# Host_Alias	WEBSERVERS = www1, www2, www3

##
## User alias specification
##
## Groups of users.  These may consist of user names, uids, Unix groups,
## or netgroups.
# User_Alias	ADMINS = millert, dowdy, mikef

##
## Cmnd alias specification
##
## Groups of commands.  Often used to group related commands together.
# Cmnd_Alias	PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
# 			    /usr/bin/pkill, /usr/bin/top
# Cmnd_Alias	REBOOT = /sbin/halt, /sbin/reboot, /sbin/poweroff

##
## Defaults specification
##
## You may wish to keep some of the following environment variables
## when running commands via sudo.
##
## Locale settings
# Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
##
## Run X applications through sudo; HOME is used to find the
## .Xauthority file.  Note that other programs use HOME to find   
## configuration files and this may lead to privilege escalation!
# Defaults env_keep += "HOME"
##
## X11 resource path settings
# Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
##
## Desktop path settings
# Defaults env_keep += "QTDIR KDEDIR"
##
## Allow sudo-run commands to inherit the callers' ConsoleKit session
# Defaults env_keep += "XDG_SESSION_COOKIE"
##
## Uncomment to enable special input methods.  Care should be taken as
## this may allow users to subvert the command being run via sudo.
# Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
##
## Uncomment to use a hard-coded PATH instead of the user's to find commands
# Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
##
## Uncomment to send mail if the user does not enter the correct password.
# Defaults mail_badpass
##
## Uncomment to enable logging of a command's output, except for
## sudoreplay and reboot.  Use sudoreplay to play back logged sessions.
# Defaults log_output
# Defaults!/usr/bin/sudoreplay !log_output
# Defaults!/usr/local/bin/sudoreplay !log_output
# Defaults!REBOOT !log_output

##
## Runas alias specification
##

##
## User privilege specification
##
root ALL=(ALL) ALL

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL

## Same thing without a password
%wheel ALL=(ALL) NOPASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
# %sudo	ALL=(ALL) ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
@includedir /etc/sudoers.d

My user's groups.

[burak@thinkpad] <~> ➤ id                                                    
uid=1000(burak) gid=984(users) groups=984(users),150(wireshark),998(wheel),1000(sudo)

Last edited by Krygen (2021-09-15 22:32:04)

Offline

#2 2021-09-12 22:57:38

Gregosky
Member
From: UK
Registered: 2013-07-26
Posts: 184

Re: Sudoers file with wheel NOPASSWD not working.

Have you logged out after adding yourself to wheel?

Also, would be nice if you wrap your code within

[code]...[/code]

smile

Last edited by Gregosky (2021-09-12 22:58:29)

Offline

#3 2021-09-13 03:01:59

Krygen
Banned
Registered: 2021-09-10
Posts: 39

Re: Sudoers file with wheel NOPASSWD not working.

Yes, I also rebooted my system couple of times

Offline

#4 2021-09-13 04:10:07

merlock
Member
Registered: 2018-10-30
Posts: 262

Re: Sudoers file with wheel NOPASSWD not working.

Do you have anything in /etc/sudoers.d ?


Eenie meenie, chili beanie, the spirits are about to speak -- Bullwinkle J. Moose
It's a big club...and you ain't in it -- George Carlin
Registered Linux user #149839
perl -e 'print$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10); '

Offline

#5 2021-09-13 04:51:11

Krygen
Banned
Registered: 2021-09-10
Posts: 39

Re: Sudoers file with wheel NOPASSWD not working.

[burak@thinkpad] <~> ➤ sudo tree /etc/sudoers.d                              
/etc/sudoers.d
|-- aurbuilder
|-- burak
`-- ctdb

0 directories, 3 files

Offline

#6 2021-09-13 06:23:38

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,289

Re: Sudoers file with wheel NOPASSWD not working.

sudo -ll

Also please post the exact command and output that requires you to enter credentials.

Offline

#7 2021-09-13 11:26:22

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Sudoers file with wheel NOPASSWD not working.

cat /etc/sudoers.d/*

No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#8 2021-09-14 05:35:46

Krygen
Banned
Registered: 2021-09-10
Posts: 39

Re: Sudoers file with wheel NOPASSWD not working.

[burak@thinkpad] <~> ➤ sudo -ll                                              
Runas and Command-specific defaults for burak:
    Defaults!/etc/ctdb/statd-callout !requiretty

User burak may run the following commands on thinkpad:

Sudoers entry:
    RunAsUsers: ALL
    Options: !authenticate
    Commands:
	ALL

Sudoers entry:
    RunAsUsers: ALL
    Commands:
	ALL

Last edited by Krygen (2021-09-14 05:36:09)

Offline

#9 2021-09-14 05:37:59

Krygen
Banned
Registered: 2021-09-10
Posts: 39

Re: Sudoers file with wheel NOPASSWD not working.

* did not work for some reason.However etc sudoer.d includes 3 files.

[burak@thinkpad] <~> ➤ sudo cat /etc/sudoers.d/burak                         
burak ALL=(ALL) ALL
[burak@thinkpad] <~> ➤ sudo cat /etc/sudoers.d/ctdb                          
Defaults!/etc/ctdb/statd-callout	!requiretty

rpcuser		ALL=(ALL) 	NOPASSWD: /etc/ctdb/statd-callout
[burak@thinkpad] <~> ➤ sudo cat /etc/sudoers.d/aurbuilder                    
aurbuilder ALL=(ALL) NOPASSWD: ALL
root ALL=(aurbuilder) NOPASSWD: ALL
[burak@thinkpad] <~> ➤              

Offline

#10 2021-09-14 05:47:52

Krygen
Banned
Registered: 2021-09-10
Posts: 39

Re: Sudoers file with wheel NOPASSWD not working.

I have manually edited the

/etc/sudoers.d/burak

file, from this->

burak ALL=(ALL) ALL

to this ->

burak ALL=(ALL) NOPASSWD: ALL

.
Now it is working, I can run sudo commands without password.
However I still can not get it, why editing sudoers file did not work both for

%wheel ALL=(ALL) NOPASSWD: ALL

, and

burak ALL=(ALL) NOPASSWD: ALL

in the first place, because it is the right and conventional way to do it

Last edited by Krygen (2021-09-14 05:48:41)

Offline

#11 2021-09-14 06:15:25

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,306

Re: Sudoers file with wheel NOPASSWD not working.

"later" matches  override earlier definitions, that file/directory is by default included last, so  of these three rules the last one is what ultimately defined your rights.

Last edited by V1del (2021-09-14 06:18:17)

Offline

#12 2021-09-14 06:17:00

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,289

Re: Sudoers file with wheel NOPASSWD not working.

Remove /etc/sudoers.d/burak - the user trumps the group.
Edit: fuck.

Last edited by seth (2021-09-14 06:17:17)

Offline

#13 2021-09-14 20:14:41

Krygen
Banned
Registered: 2021-09-10
Posts: 39

Re: Sudoers file with wheel NOPASSWD not working.

Thank you everyone, now how can I lock the thread big_smile

Offline

#14 2021-09-14 20:22:14

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,289

Re: Sudoers file with wheel NOPASSWD not working.

Mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

#15 2021-09-15 22:39:57

Krygen
Banned
Registered: 2021-09-10
Posts: 39

Re: Sudoers file with wheel NOPASSWD not working.

Could not find it

Offline

#16 2021-09-15 22:41:33

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: Sudoers file with wheel NOPASSWD not working.

There is an Edit button at the bottom right of your post. Editing the first post will allow you to change the title.

Offline

Board footer

Powered by FluxBB