Results 1 to 6 of 6

Thread: [SOLVED] visudo and shutdown

  1. #1
    Join Date
    Feb 2008
    Beans
    85

    [SOLVED] visudo and shutdown

    Hi people,

    I'd like to shutdown my computer via Kcron job, but when I type sudo shutdown -h now, or sudo halt/reboot it still ask me for a password.

    this is my /etc/sudoers file:

    Code:
    # /etc/sudoers
    #
    # This file MUST be edited with the 'visudo' command as root.
    #
    # See the man page for details on how to write a sudoers file.
    #
    
    Defaults	env_reset
    
    # Uncomment to allow members of group sudo to not need a password
    # %sudo ALL=NOPASSWD: ALL
    
    # Host alias specification
    
    # User alias specification
    
    # Cmnd alias specification
    #Cmnd_Alias SYSTEM = /sbin/shutdown, /sbin/halt, /sbin/reboot, /sbin/poweroff
    
    # User privilege specification
    root	ALL=(ALL) ALL
    %admin ALL = (ALL) NOPASSWD:/sbin/shutdown -hP now
    
    # Members of the admin group may gain root privileges
    
    # Members of the admin group may gain root privileges
    %admin ALL=(ALL) ALL
    As you can see, I've tried other stuff too (username: andi/%admin, Cmnd Alias etc) but nothing worked.

    I am running Kubuntu 8.04, KDE 3.59
    Linux andibuntu 2.6.24-19-generic #1 SMP Wed Aug 20 22:56:21 UTC 2008 i686 GNU/Linux


    nothing helped:
    http://www.staschke.de/linux/shutdown.html
    http://linux.byexamples.com/archives...sudo-password/

    There must be a solution ey?

    ThXX!
    Last edited by desmane; September 3rd, 2008 at 03:56 PM.

  2. #2
    Join Date
    Jun 2008
    Location
    England
    Beans
    2,567
    Distro
    Ubuntu Development Release

    Re: visudo and shutdown

    Have you tried Kshutdown or must it be Kcron
    64-Bit User-Group // Twin-View AMD64 X2 6000+|Geforce 9500GT 1024 MB|8GB PC2-6400 DDR2|500GB Seagate SATA // AMD64 X2 4400+|Geforce 8600GTS |4GB PC2-6400 DDR2|360GB Samsung SATA // Ubuntu 9.04 & 9.10 64-Bit

  3. #3
    Join Date
    Feb 2008
    Beans
    85

    Re: visudo and shutdown

    Yeah, I'd like to use the halt / shutdown -h command because it shuts down my computer immediately (kaffeine for example ask for confirmation) and kshutdown doesn't manage to quit kdm properly.
    Last edited by desmane; September 5th, 2008 at 08:58 PM.

  4. #4
    Join Date
    Feb 2008
    Beans
    85

    Re: visudo and shutdown

    I figured it out, you have to restart x.
    this is how it looks like:
    Code:
    # User privilege specification
    root	ALL=(ALL) ALL
    username	ALL=NOPASSWD: /sbin/halt
    # Members of the admin group may gain root privileges
    # Members of the admin group may gain root privileges
    %admin ALL=(ALL) ALL
    but still doesnt work after I restsart the computer. But is wrong here? Anybody?
    Should I dpkg reinstall something do make it work?
    Last edited by desmane; September 6th, 2008 at 07:51 AM.

  5. #5
    Join Date
    Sep 2008
    Beans
    1

    Re: visudo and shutdown

    I had the same problem (seemed to work but didn't after restarting the computer). I was getting very frustrated that the normal suggestions were simply not working. I found that putting the NOPASSWD line at the end of the sudoers file worked. Mine currently is:
    Code:
    # User privilege specification
    root    ALL=(ALL) ALL
    
    # Members of the admin group may gain root privileges
    %admin ALL=(ALL) ALL
    
    username ALL = NOPASSWD: /sbin/poweroff
    I have no idea why this worked, and I just stumbled up on by copying another sudoers file I found posted somewhere. Hopefully this was actually the change that got my setup working, and not some other random thing Good luck

  6. #6
    Join Date
    Feb 2008
    Beans
    85

    Re: visudo and shutdown

    thx!!

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •