You are not logged in.

#1 2009-03-10 21:18:00

blackhole
Member
From: Karlsruhe, Germany
Registered: 2008-12-14
Posts: 148
Website

Still not working: sudoers file has no effect

Hi guys,

I've recently added the following lines via visudo to the sudoers file when installing yaourt:

schorsch    ALL=NOPASSWD: /usr/bin/pacman
schorsch    ALL=NOPASSWD: /usr/bin/pacdiffviewer

However I'm still asked a password when using pacman and yaourt. Even when I manually type "sudo pacman -Ss foo" I have to enter my password. What's wrong?

Here's my complete sudoers file:

# 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

# User alias specification

# Cmnd alias specification

# Defaults specification

# Runas alias specification

# User privilege specification
root        ALL=(ALL) ALL
schorsch    ALL=NOPASSWD: /usr/bin/pacman
schorsch    ALL=NOPASSWD: /usr/bin/pacdiffviewer

# Uncomment to allow people in group wheel to run all commands
%wheel    ALL=(ALL) ALL

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

# Samples
# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users  localhost=/sbin/shutdown -h now

TIA,
Blackhole

Last edited by blackhole (2009-03-11 07:37:08)


Coming closer and closer to the ultimate goal: replacing boring old Windows XP desktop with shiny new Arch KDE 4 desktop. ^^
Already registered? Your vote counts!

Offline

#2 2009-03-10 21:22:54

haxit
Member
From: /home/haxit
Registered: 2008-03-04
Posts: 1,247
Website

Re: Still not working: sudoers file has no effect

Oops, scratch that. Never mind, sorry.

Last edited by haxit (2009-03-10 21:23:19)


Archi686 User | Old Screenshots | Old .Configs
Vi veri universum vivus vici.

Offline

#3 2009-03-10 21:32:50

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,385
Website

Re: Still not working: sudoers file has no effect

blackhole wrote:
# sudoers file.
...
schorsch    ALL=NOPASSWD: /usr/bin/pacman
schorsch    ALL=NOPASSWD: /usr/bin/pacdiffviewer
...
# Same thing without a password
# %wheel    ALL=(ALL) NOPASSWD: ALL

See the slight difference in syntax there.  You want:

schorsch    ALL=(ALL)    NOPASSWD: /usr/bin/pacman

Offline

#4 2009-03-10 21:40:57

blackhole
Member
From: Karlsruhe, Germany
Registered: 2008-12-14
Posts: 148
Website

Re: Still not working: sudoers file has no effect

aaaaaaaahhhhhh, stupid me!!! Thanks a lot Allan.

@Haxit: Scratch what? ;-)

Last edited by blackhole (2009-03-10 21:47:06)


Coming closer and closer to the ultimate goal: replacing boring old Windows XP desktop with shiny new Arch KDE 4 desktop. ^^
Already registered? Your vote counts!

Offline

#5 2009-03-11 07:36:32

blackhole
Member
From: Karlsruhe, Germany
Registered: 2008-12-14
Posts: 148
Website

Re: Still not working: sudoers file has no effect

Erm, it still doesn't work:

schorsch@archie:~$ sudo pacman -Rs gvim
Password:

My sudoers file:

# 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

# User alias specification

# Cmnd alias specification

# Defaults specification

# Runas alias specification

# User privilege specification
root        ALL=(ALL) ALL
schorsch    ALL=(ALL) NOPASSWD: /usr/bin/pacman
schorsch    ALL=(ALL) NOPASSWD: /usr/bin/pacdiffviewer

# Uncomment to allow people in group wheel to run all commands
%wheel    ALL=(ALL) ALL

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

# Samples
# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users  localhost=/sbin/shutdown -h now

Any ideas?


Coming closer and closer to the ultimate goal: replacing boring old Windows XP desktop with shiny new Arch KDE 4 desktop. ^^
Already registered? Your vote counts!

Offline

#6 2009-03-11 09:30:29

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Still not working: sudoers file has no effect

First, please stay with your config and then try to run pacdiffviewer with sudo, I'm quite sure, that it doesn't ask for a password. If so, I understood it right smile

Mine:

# 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

# User alias specification

# Cmnd alias specification

# Defaults specification
Defaults !lecture,tty_tickets,!fqdn,insults
# Runas alias specification

# User privilege specification
root    ALL=(ALL) ALL
army    ALL=(ALL) ALL
army    ALL=NOPASSWD: /sbin/reboot
army    ALL=NOPASSWD: /sbin/halt

# Uncomment to allow people in group wheel to run all commands
# %wheel    ALL=(ALL) ALL

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

# Samples
# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users  localhost=/sbin/shutdown -h now

I guess you FIRST have to give yourself the right to use sudo and THEN allow yourself the useage of sudo without a password for specific commands.

Last edited by Army (2009-03-11 09:33:39)

Offline

#7 2009-03-11 10:48:24

klixon
Member
From: Nederland
Registered: 2007-01-17
Posts: 525

Re: Still not working: sudoers file has no effect

No, that's not the problem.
The problem is that you give your user NOPASSWD right and then overwrite those rights with the %wheel line...
You're effectively saying:
1. Give me NOPASSWD access to reboot and halt
2. Give me (i'm in group wheel) PASSWD access to everything (including reboot and halt wink)

Just put the to NOPASSWD lines after the %wheel line and it should work


Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!

Offline

#8 2009-03-11 12:11:14

blackhole
Member
From: Karlsruhe, Germany
Registered: 2008-12-14
Posts: 148
Website

Re: Still not working: sudoers file has no effect

Ah, that makes perfectly sense, Klixon. I wouldn't have thought that the order of the lines in sudoers is important. I'd assumed that user specific settings overrule group specific settings. Well, I'll try...


Coming closer and closer to the ultimate goal: replacing boring old Windows XP desktop with shiny new Arch KDE 4 desktop. ^^
Already registered? Your vote counts!

Offline

Board footer

Powered by FluxBB