Find the answer to your Linux question:
Results 1 to 7 of 7
ok... im trying to use terminal to shutdown the computer but when i type in shutdown -r now it says 'needed to be root' any suggestions or comments?...
  1. #1
    Just Joined!
    Join Date
    Feb 2008
    Posts
    2

    Thumbs down terminal

    ok...
    im trying to use terminal to shutdown the computer but when i type in
    shutdown -r now
    it says 'needed to be root'
    any suggestions or comments?

  2. #2
    Just Joined!
    Join Date
    Feb 2008
    Posts
    5
    try
    su -c "shutdown -r now"

  3. #3
    Linux Newbie
    Join Date
    Nov 2007
    Location
    Planet Earth
    Posts
    152
    -r option is for reboot... use -h to halt the computer:
    Code:
    sudo shutdown -h now
    EOF

  4. #4
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    Which Linux distro are you using?
    Use sudo in Ubuntu or its variants and su - in other distros.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  5. #5
    Just Joined!
    Join Date
    Feb 2008
    Posts
    2
    ok thanks.. ill try that...
    and i know that -r does system restart and -h does halt or shutdown
    i am using ubuntu tho...

  6. #6
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    You should execute this to shutdown machine.
    Code:
    sudo shutdown -h now
    Check this sticky on sudo.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  7. #7
    Linux Enthusiast Manchunian's Avatar
    Join Date
    Dec 2007
    Location
    France but my heart stays in Britain
    Posts
    675
    Unix systems, by default, don't let a normal user shut down the computer. This is because Unix worked as a network, and so if any old Tom Dick or Harry could turn off the computer it could be a disaster.
    If you don't like this behaviour, you can disable it quite easily by editing the sudoers file. Alternatively, and this was what I did (as I use Fluxbox and I didn't want to have to go to the log in screen every time I wanted to switch of the computer) you can change permissions on halt or shutdown to allow execution by anyone. This is what I did (in Debian):
    Code:
    cd /sbin/
    chmod 0777 halt
    This works very well for me.
    Distribution: Archlinux
    Processor: 3 x Amd 64 bit
    Ram: 4 GB
    Graphics card: Nvidia GeForce 9800 GT

Posting Permissions

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