This is a discussion on Re: How to allow user shutdown - SGI ; On Thu, 17 Jul 2003, Jason L. wrote: > I would like to know if it's possible at all to setup a user account > to shutdown a machine. I've never set up a user account to do this, but ...
On Thu, 17 Jul 2003, Jason L. wrote:
> I would like to know if it's possible at all to setup a user account
> to shutdown a machine.
I've never set up a user account to do this, but I suspect you're
having a problem with not being the superuser, thus that user can't
execute the necessary system calls to cause the machine to shut down.
I'm sure it can be done, but I have a possibly better solution for
you.
Years ago my computer-neophyte roommate occasionaly needed to be able
to shut down my R4K Indigo. To make this easy for him I put the
following script on the computer, made it suid-root (this machine
was not networked and I barely trusted my roommate to remember his
password, much less hack into the machine), and slapped a link to
the script on his desktop. This gave him a nice GUI confirmation
dialog and thus was very user-friendly.
If I had to do it over again I'd probably just write a shell script
and utilize xconfirm, but I was a bit of an IRIX neophyte myself
at that time, and Tcl/Tk was fresh in my memory.
Anyway, here it is for your use/objection/amusement:
--- cut here ---
#!/usr/bin/wish
frame .top
pack .top -side top -fill x
label .top.label -text "Are you sure you want to\nshut down the computer?"
pack .top.label -in .top -side top -expand 1 -fill x
frame .bottom
pack .bottom -side bottom -fill x
button .bottom.yes -text "Yes"
button .bottom.no -text "No"
pack .bottom.yes .bottom.no -in .bottom -side left -expand 1 -fill x
bind .bottom.yes{exec /etc/shutdown -g0 -y&}
bind .bottom.no{exit 0}
--- cut here ---
Hope that helps,
Brent Casavant
--
Brent Casavant bcasavan@sgi.com Forget bright-eyed and
Operating System Engineer http://www.sgi.com/ bushy-tailed; I'm red-
Silicon Graphics, Inc. 44.8562N 93.1355W 860F eyed and bushy-haired.