Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Shutting of the computer
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
MdaG
l33t
l33t


Joined: 09 Nov 2004
Posts: 945
Location: Stockholm, Sverige

PostPosted: Tue Dec 14, 2004 9:07 pm    Post subject: Shutting of the computer Reply with quote

Is it possible to shut off the computer (clean) without being root? I'm running a deskop and don't really need to be root just to turn off the comp.
Back to top
View user's profile Send private message
Vanquirius
Retired Dev
Retired Dev


Joined: 14 Jun 2002
Posts: 1297
Location: Ethereal plains

PostPosted: Tue Dec 14, 2004 9:27 pm    Post subject: Reply with quote

I'm not sure if you can do it as a user, but you could always set-up sudo to allow you to halt your machine. You could also have an alias for "sudo halt".
_________________
Hello.
Back to top
View user's profile Send private message
malone
Apprentice
Apprentice


Joined: 19 Feb 2004
Posts: 159
Location: The p-n junction.

PostPosted: Tue Dec 14, 2004 9:48 pm    Post subject: Reply with quote

Or you can setuid /sbin/shutdown though the man page says shutdown wasn't designed for that,
Code:
chmod u+s /sbin/shutdown

and any user can run shutdown.
_________________
malone
Back to top
View user's profile Send private message
MdaG
l33t
l33t


Joined: 09 Nov 2004
Posts: 945
Location: Stockholm, Sverige

PostPosted: Tue Dec 14, 2004 10:10 pm    Post subject: Reply with quote

malone wrote:
Or you can setuid /sbin/shutdown though the man page says shutdown wasn't designed for that,
Code:
chmod u+s /sbin/shutdown

and any user can run shutdown.


"..wasn't designed for that" ?

The thing is, I'd like to create a "button" so that I can turn of my computer "XP-style".
Back to top
View user's profile Send private message
malone
Apprentice
Apprentice


Joined: 19 Feb 2004
Posts: 159
Location: The p-n junction.

PostPosted: Tue Dec 14, 2004 10:30 pm    Post subject: Reply with quote

Quote:
"..wasn't designed for that" ?

I assume it means that there wasn't any extra attention paid to security.
From the man page,
Quote:
Shutdown wasn't designed to be run setuid.

That's all it says on the topic. This is the solution that I use on my ancient laptop that doesn't have any kind of gui except X to run an xvnc session. You want it as a button, no problem - just make it execute a command like,
Code:
/sbin/shutdown -h now

You should also be able to setuid on some of the other ones such as /sbin/poweroff and /sbin/reboot. It's been a while since I use kde, but iirc poweroff is more along the lines of what people usually want instead of a system halt.
_________________
malone
Back to top
View user's profile Send private message
MdaG
l33t
l33t


Joined: 09 Nov 2004
Posts: 945
Location: Stockholm, Sverige

PostPosted: Wed Dec 15, 2004 9:07 am    Post subject: Reply with quote

What's the difference between system halt and power off?

I'm running fluxbox so I have to make all my "shortcuts" myself. :)
Back to top
View user's profile Send private message
To
Veteran
Veteran


Joined: 12 Apr 2003
Posts: 1145
Location: Coimbra, Portugal

PostPosted: Wed Dec 15, 2004 9:55 am    Post subject: Reply with quote

MdaG wrote:
What's the difference between system halt and power off?

I'm running fluxbox so I have to make all my "shortcuts" myself. :)


Same thing.


_________________

------------------------------------------------
Linux Gandalf 3.2.35-grsec
Gentoo Base System version 2.2
------------------------------------------------
Back to top
View user's profile Send private message
malone
Apprentice
Apprentice


Joined: 19 Feb 2004
Posts: 159
Location: The p-n junction.

PostPosted: Wed Dec 15, 2004 1:06 pm    Post subject: Reply with quote

Quote:
What's the difference between system halt and power off?

Why not try them both out and see? They do almost the same thing but not quite. Halting the system brings everything down but your computer will still be on, you'll still be able to see output on your monitor, hear the fan running, etc. Poweroff does everything halt does but then does a poweroff. In fact, /sbin/halt has an option -p :
Quote:
-p When halting the system, do a poweroff. This is the default when halt is called as poweroff.

_________________
malone
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum