You are not logged in.

#1 2016-04-09 15:23:49

Peregrino69
Member
Registered: 2016-03-11
Posts: 99

[SOLVED] sudo without password

Hi guys

For some reason I can't get sudo w/o password working. I entered to sudoers file via visudo:

user ALL=(ALL) NOPASSWD:ALL

... but for some reason it's not working. What gives?

Last edited by Peregrino69 (2016-04-09 21:25:38)

Offline

#2 2016-04-09 15:29:43

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: [SOLVED] sudo without password

Check the spacing between ALL=(ALL) and the spacing between NOPASSWD:ALL   You may need a specific spacing syntax?  Does the visudo give you any syntax errors?


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#3 2016-04-09 16:11:15

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: [SOLVED] sudo without password

Does this work?

user ALL=(ALL) NOPASSWD: /usr/bin/sudo

Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#4 2016-04-09 16:14:11

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: [SOLVED] sudo without password

Please post the output of:

sudo grep -v '^#\|^$' /etc/sudoers

Is your user really called "user"?

Offline

#5 2016-04-09 17:23:38

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: [SOLVED] sudo without password

check this out: https://wiki.archlinux.org/index.php/Sudoers

btw, you will still have to prepend "sudo" to commands even if it doesn't ask for a password.

Offline

#6 2016-04-09 18:25:39

Peregrino69
Member
Registered: 2016-03-11
Posts: 99

Re: [SOLVED] sudo without password

Hi HoaS & damo smile

Horizon_Brave wrote:

Check the spacing between ALL=(ALL) and the spacing between NOPASSWD:ALL   You may need a specific spacing syntax?  Does the visudo give you any syntax errors?

I've tried both tab and space between the terms, also with or without space between NOPASSWD: ALL. This is a standard Bunsen i.e. Deb8 installation, and I'm not aware of any specific syntax here. Worked fine with Waldorf i.e. Wheezy.

damo wrote:

user ALL=(ALL) NOPASSWD: /usr/bin/sudo

Sorry, doesn't work either.

Head_on_a_Stick wrote:

Is your user really called "user"?

LOL no big_smile Just pgrino69 smile

Before damo's suggestion:

pgrino69@Bunsen1:~$ sudo grep -v '^#\|^$' /etc/sudoers
Defaults	env_reset
Defaults	mail_badpass
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
root	ALL=(ALL:ALL) ALL
pgrino69 	ALL=(ALL) NOPASSWD: ALL
%sudo	ALL=(ALL:ALL) ALL

After damo's suggestion:

pgrino69@Bunsen1:~$ sudo grep -v '^#\|^$' /etc/sudoers
Defaults	env_reset
Defaults	mail_badpass
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
root	ALL=(ALL:ALL) ALL
pgrino69 	ALL=(ALL) NOPASSWD: ALL
%sudo	ALL=(ALL:ALL) ALL

Offline

#7 2016-04-09 18:32:26

Peregrino69
Member
Registered: 2016-03-11
Posts: 99

Re: [SOLVED] sudo without password

Ooop!

ohnonot wrote:

check this out: https://wiki.archlinux.org/index.php/Sudoers

btw, you will still have to prepend "sudo" to commands even if it doesn't ask for a password.

Hi to you as well smile I know that one from way back when. Arch Wiki is still one of my preferred resources for a lot of things smile

HoaS, for comparison the output from my venerable Waldorf workhorse:

Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
root    ALL=(ALL:ALL) ALL
pgrino69   ALL=(ALL) NOPASSWD: ALL
%sudo   ALL=(ALL:ALL) ALL

Last edited by Peregrino69 (2016-04-09 18:32:46)

Offline

#8 2016-04-09 20:07:55

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: [SOLVED] sudo without password

Adding my username to sudoers using that exact syntax works just fine on my BL (& Arch) systems hmm

I don't know why that's not working, sorry.

Offline

#9 2016-04-09 20:22:03

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: [SOLVED] sudo without password

Wait!

Remove your user from the sudo group and try again:

sudo gpasswd -d pgrino69 sudo

The last line over-rides the previous lines and does not specify NOPASSWD for those in the sudo group.

Offline

#10 2016-04-09 21:00:59

Peregrino69
Member
Registered: 2016-03-11
Posts: 99

Re: [SOLVED] sudo without password

HoaS saves the day again!

... but I have absolutely on clue what just happened. After following your advise:

pgrino69@Bunsen1:~$ sudo grep -v '^#\|^$' /etc/sudoers
Defaults	env_reset
Defaults	mail_badpass
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
root	ALL=(ALL:ALL) ALL
pgrino69	ALL=(ALL) NOPASSWD: ALL
%sudo	ALL=(ALL:ALL) ALL

... plus the output from Waldorf and Bunsen are exactly the same to my eyes... can you possibly clarify this a bit?  *confusioned*

Offline

#11 2016-04-09 21:09:53

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: [SOLVED] sudo without password

Peregrino69 wrote:

can you possibly clarify this a bit?

All you have done is removed pgrino69 from the sudo group -- the password is still set for those in the sudo group but your user has NOPASSWD set and is no longer in the sudo group.

For your #! system, either pgrino69 was not in the sudo group or the behaviour of `sudo` & /etc/sudoers has changed between wheezy & jessie.

Offline

#12 2016-04-09 21:24:43

Peregrino69
Member
Registered: 2016-03-11
Posts: 99

Re: [SOLVED] sudo without password

Oki. I guess that makes sense big_smile

Offline

#13 2016-04-09 21:25:30

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: [SOLVED] sudo without password

Please add [SOLVED] to the thread title to help others who may have this problem wink

Offline

Board footer

Powered by FluxBB