Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 11-26-2007, 03:26 AM   #1
LQ Newbie
Registered: May 2007
Posts: 7

Rep: Reputation: 0
Poweroff computer as normal user


I have an application which has two buttons to shutdown and restart the machine. This application will run as a user with very few privileges (user nobody). The command "poweroff" and "reboot" won't work:
when command 'reboot' is run i get the message: reboot: must be a superuser
when command 'poweroff' is run i get the message: poweroff: No.

I tried to change the permission for: /sbin/halt, /sbin/reboot, /sbin/shutdown, /sbin/poweroff as follows:
chmod u+s /sbin/halt
chmod u+s /sbin/shutdown
chmod u+s /sbin/reboot
chmod u+s /sbin/poweroff

when i try to run 'poweroff' command after that as user 'nobody' i get the same error as without changing the permissions.
when i try to run 'reboot' i get an error smth like, operation not allowed and then the pc restarts.

Actually, i'm doing this in a thin client and i don't have sudo.

Anyone has any idea?

Thanks in advance
Old 11-26-2007, 03:42 AM   #2
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
I was going to suggest sudo until three lines from the bottom of your post...

The setuid bit means the effective user id is taken from the owner of the file. You should verify that the owner of these files is indeed root, and not bin or some other user.

I was always a little fuzzy on the particulars of setuid because it varies slightly on different unixes. I seem to recall reading that on Linux setuid does nothing if the file is a script (as opposed to a binary). On most distros I think these files are regular binaries, but I could imagine some customised distro replacing them with a script... Check they are actually binaries.

One other thing to check... that the filesystem where /sbin is stored doesn't have the nosuid mount flag set, or one of the other mount options which implies it.

If you're sure the programs are running as root, I'm not sure what is going on.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Poweroff as user Murdock1979 Slackware 18 07-21-2008 05:18 AM
poweroff with own user jaakkop Linux - General 2 12-28-2004 07:07 AM
Can Real Poweroff Computer without recompile kernel? strato Red Hat 2 11-23-2004 09:25 AM
Can Real Poweroff Computer without recompile kernel? strato Linux - Software 4 11-21-2004 01:04 AM
Updating to Kernel 2.6, poweroff freezes computer lunatic fringe Linux - Software 2 01-26-2004 05:25 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration