Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: [SOLVED] shutdown without password

  1. #1
    Join Date
    Apr 2009
    Beans
    80
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Angry [SOLVED] shutdown without password

    Resolution located at HERE

    Hi All,
    I've search through google, and even through this ubuntu forum, but seems all suggestions still not giving me any solution

    I'm using Ubuntu server version.

    I want to be able to shutdown without asking for password, this is what I do:
    sudo visudo and add the following:
    Code:
    user ALL=NOPASSWD: /sbin/shutdown
    Now, I try to logout and log back in, and type
    Code:
    shutdown -r now
    or
    Code:
    /sbin/shutdown -r now
    The above command giving an error message: shutdown: need to be root

    I think that error message comes up because the shutdown file is owned by root, right? or wrong?

    I try:
    Code:
    sudo shutdown -r now
    or
    Code:
    sudo /sbin/shutdown -r now
    The above command asking me for [sudo] password

    Anything that I miss here?
    Last edited by televisi; June 8th, 2009 at 06:31 AM.

  2. #2
    Join Date
    Jun 2009
    Beans
    9

    Re: shutdown without password

    You could run "sudo -s" to get a root shell. You'd need to enter a password to get the root shell, but after that, it shouldn't prompt you.

  3. #3
    Join Date
    Dec 2008
    Beans
    225

    Re: shutdown without password

    why would you like to do this, maybe if we knew what you where doing we could say how
    "I got this car home and all there where where a bunch of bricks?" -linux is not windows

  4. #4
    Join Date
    Apr 2009
    Beans
    80
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: shutdown without password

    hi mgt_90,
    Er.. the purpose is shutdown without asking for password, and by using 'sudo -s' or even 'sudo -i' are not really what I want, if you know what I mean....

  5. #5
    Join Date
    Mar 2009
    Location
    Land of the sand
    Beans
    Hidden!
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: shutdown without password

    Try
    Code:
    televisi ALL=(ALL)NOPASSWD:/sbin/shutdown
    televisi = user
    ALL = any host /ip
    (ALL) = can run as any user
    Peace
    YAY! #200

  6. #6
    Join Date
    Jun 2009
    Beans
    9

    Re: shutdown without password

    Quote Originally Posted by televisi View Post
    hi mgt_90,
    Er.. the purpose is shutdown without asking for password, and by using 'sudo -s' or even 'sudo -i' are not really what I want, if you know what I mean....
    Any particular reason why you don't want it to prompt for a password? If it's something like a cron job, then can't you get root to run that?

  7. #7
    Join Date
    Feb 2007
    Location
    Marseille, France
    Beans
    184
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: shutdown without password

    Try
    Code:
    username ALL=NOPASSWD:/sbin/shutdown
    username ALL=NOPASSWD:/etc/init.d
    Then run
    Code:
    sudo shutdown -h now
    Seems that shutdown calls processes from init.d so you must have access to that also. See https://answers.launchpad.net/ubuntu/+question/7998

  8. #8
    Join Date
    Apr 2009
    Beans
    80
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: shutdown without password

    Hi Purple,
    I put exactly the same as you suggested then I:
    - restart manually the system
    - login back as user
    - run sudo shutdown -r now
    - System still asking me for the SUDO password, strange things?

    is it really a big matter to put <SPACE> or <TAB> in combination in between characters?

    Code:
    user<SPACE>ALL<SPACE>=<SPACE>(ALL)<SPACE>NOPASSWD:<SPACE>/sbin/shutdown
    or
    Code:
    user<TAB>ALL<SPACE>=<SPACE>(ALL)<SPACE>NOPASSWD:<SPACE>/sbin/shutdown

    Quote Originally Posted by _Purple_ View Post
    Try
    Code:
    televisi ALL=(ALL)NOPASSWD:/sbin/shutdown
    televisi = user
    ALL = any host /ip
    (ALL) = can run as any user

  9. #9
    Join Date
    Apr 2009
    Beans
    80
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: shutdown without password

    hi terdon,
    Your suggestion still not working right after I restart the system manually.

    This is what I add in /etc/sudoers:
    Code:
    user ALL=(ALL) NOPASSWD:/sbin/shutdown, /etc/init.d

    Quote Originally Posted by terdon View Post
    Try
    Code:
    username ALL=NOPASSWD:/sbin/shutdown
    username ALL=NOPASSWD:/etc/init.d
    Then run
    Code:
    sudo shutdown -h now
    Seems that shutdown calls processes from init.d so you must have access to that also. See https://answers.launchpad.net/ubuntu/+question/7998

  10. #10
    Join Date
    May 2005
    Location
    US
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: shutdown without password

    Please don't ever run sudo -s. If you want a persistent root prompt, use
    Code:
    sudo -i
    That said, I don't think either will really help you in this case.

    If you've done as you said, then you've done everything right, assuming user is just a placeholder for your actual username.

    In other words, if your username is televisi, then it should be
    Code:
    televisi ALL=NOPASSWD: /sbin/shutdown
    and not
    Code:
    user ALL=NOPASSWD: /sbin/shutdown

Page 1 of 2 12 LastLast

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
  •