Results 1 to 8 of 8

Thread: SHutdown without enetering password

  1. #1
    Join Date
    Jan 2010
    Beans
    18

    SHutdown without enetering password

    I want to close my system using a scipt. The scipt runs shutdown -h now to close the system but it needs root privileges. I dont want to enter the password every time on terminal. Is there a way that the commnad can be run with root privilege or the password could be saved in some file or in the scipt itself so that it does not asks for password each time I run the scipt. Please help

  2. #2
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Kubuntu 11.04 Natty Narwhal

    Re: SHutdown without enetering password

    Code:
    sudo chmod +s /sbin/shutdown 
    
    gives superuser flag to shutdown
    Last edited by realzippy; September 26th, 2011 at 01:15 PM.

  3. #3
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: SHutdown without enetering password

    Quote Originally Posted by gunjannigam View Post
    I want to close my system using a scipt. The scipt runs shutdown -h now to close the system but it needs root privileges. I dont want to enter the password every time on terminal. Is there a way that the commnad can be run with root privilege or the password could be saved in some file or in the scipt itself so that it does not asks for password each time I run the scipt. Please help
    Edit the sudoers file:
    Code:
    sudo visudo
    and append it with:
    Code:
    username ALL=(root) NOPASSWD:/sbin/shutdown -h now
    replace usernaem with your login name.

    HowTO: Sudoers Configuration

  4. #4
    Join Date
    Jan 2010
    Beans
    18

    Re: SHutdown without enetering password

    Quote Originally Posted by realzippy View Post
    sudo chmod +s /sbin/shutdown

    gives superuser flag to shutdown
    It still asks for password

  5. #5
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Kubuntu 11.04 Natty Narwhal

    Re: SHutdown without enetering password

    Quote Originally Posted by gunjannigam View Post
    It still asks for password
    ???
    Do you still run "sudo" ?
    Try:

    shutdown -h now

  6. #6
    Join Date
    Jan 2010
    Beans
    18

    Re: SHutdown without enetering password

    Quote Originally Posted by realzippy View Post
    ???
    Do you still run "sudo" ?
    Try:

    shutdown -h now
    Yaa I still use sudo
    Without sudo it says you need to be root

  7. #7
    Join Date
    Jan 2010
    Beans
    18

    Re: SHutdown without enetering password

    sisco311 method worked thanks
    Last edited by gunjannigam; January 28th, 2010 at 03:30 PM.

  8. #8
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Kubuntu 11.04 Natty Narwhal

    Re: SHutdown without enetering password

    Without sudo it says you need to be root

    yep,until you run:sudo chmod +s /sbin/shutdown,then it will not ask

    but anyway sisco311's method is smarter.. at least on multiuser systems ...

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
  •