Re: [6.3] Assigning shutdown to eg. Syst?

2008-12-23 Thread Frank Shute
On Mon, Dec 22, 2008 at 03:31:27PM +0100, Gilles wrote:

 Hello
 
 I'd like to make it easier for my dad to shutdown a server. Instead of
 having him plug a keyboard, log on as root (with a complicated
 password) and finally type shutdown -h now, is it possible to assign
 this command to some unused key like eg. Syst? Even better, send this
 command only if the key is hit eg. three times within 2 seconds?
 
 Thank you.
 

What I'd do is use sudo to enable him to shutdown. Then I'd add this
to /etc/rc.local:

kbdcontrol -f 10 sudo shutdown -h now

So, pressing F10  hitting return will shut the machine down.

Regards,

-- 

 Frank 


 Contact info: http://www.shute.org.uk/misc/contact.html 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: [6.3] Assigning shutdown to eg. Syst?

2008-12-23 Thread perryh
 The only other thing being in group operator lets you run,
 apart from what you've added into /etc/devfs.{conf,rules} is
 /sbin/mksnap_ffs ..

In a default devfs config, it grants read permission to
the disk devices (presumably to enable running dump(8)).
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: [6.3] Assigning shutdown to eg. Syst?

2008-12-23 Thread Ian Smith
On Tue, 23 Dec 2008, per...@pluto.rain.com wrote:
   The only other thing being in group operator lets you run,
   apart from what you've added into /etc/devfs.{conf,rules} is
   /sbin/mksnap_ffs ..
  
  In a default devfs config, it grants read permission to
  the disk devices (presumably to enable running dump(8)).

True, so if Gilles' dad really wants to run dump, he most likely can.

The .snap directory in the root of a (mounted) file system to be dumped 
has owner root, group operator, mode 0770 - paraphrasing from dump(8) -
and then he'd need mount and write permissions on the dump destination.

Doesn't sound too risky if Gilles trusts him enough to run shutdown :)

cheers, Ian
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: [6.3] Assigning shutdown to eg. Syst?

2008-12-23 Thread Mike Clarke
On Tuesday 23 December 2008, Ian Smith wrote:

 Doesn't sound too risky if Gilles trusts him enough to run shutdown
 :)

For a desktop there's no logic in restricting the shutdown command to 
only trusted users anyway. An untrusted user can't be prevented from 
shutting down by pulling the plug, far better to let (and encourage) 
him use shutdown instead

-- 
Mike Clarke
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


[6.3] Assigning shutdown to eg. Syst?

2008-12-22 Thread Gilles
Hello

I'd like to make it easier for my dad to shutdown a server. Instead of
having him plug a keyboard, log on as root (with a complicated
password) and finally type shutdown -h now, is it possible to assign
this command to some unused key like eg. Syst? Even better, send this
command only if the key is hit eg. three times within 2 seconds?

Thank you.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: [6.3] Assigning shutdown to eg. Syst?

2008-12-22 Thread Polytropon
On Mon, 22 Dec 2008 15:31:27 +0100, Gilles gilles.gana...@free.fr wrote:
 Hello
 
 I'd like to make it easier for my dad to shutdown a server. Instead of
 having him plug a keyboard, log on as root (with a complicated
 password) and finally type shutdown -h now, is it possible to assign
 this command to some unused key like eg. Syst? Even better, send this
 command only if the key is hit eg. three times within 2 seconds?

I have a similar setting, but it requires X, WindowMaker and a
Sun Type 6 USB keyboard. :-)

Short explaination: I have assigned the command

xterm -class SHUTDOWN -fg black -bg red -e shutdown -p now ; read 
DUMMY

to the key combination Ctrl+Alt+(I) - the switch off or moon
key on the top right. This combination is impossible to press
accidentally. (Without Ctrl and Alt, this key closes the X session
and leads back to xdm for login.)

You could add a clickable menu entry or desktop icon with this
command, but make sure it's not accidentally clicked. :-)



If your father is already logged in, he could shutdown -p now
(or using an alias) from an xterm. He needs to be in the wheel
(or at least operator?) group for this.



What about pressing the power button on the machine itself, it
should perform a shutdown -p now (shut down and power off).



By tht eay, the key you're refering to is named System Request,
or SysRq.



-- 
Polytropon
From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: [6.3] Assigning shutdown to eg. Syst?

2008-12-22 Thread Gilles
On Mon, 22 Dec 2008 16:09:02 +0100, Polytropon free...@edvax.de
wrote:
I have a similar setting, but it requires X, WindowMaker and a
Sun Type 6 USB keyboard. :-)

Thanks for the input, but this server is text-only. I'll try to find
how FreeBSD is configured so that ALT-CTRL-DEL maps to reboot, and
add my own keyboard key to shut it down.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: [6.3] Assigning shutdown to eg. Syst?

2008-12-22 Thread Dan Nelson
In the last episode (Dec 22), Gilles said:
 On Mon, 22 Dec 2008 16:09:02 +0100, Polytropon free...@edvax.de
 wrote:
 I have a similar setting, but it requires X, WindowMaker and a
 Sun Type 6 USB keyboard. :-)
 
 Thanks for the input, but this server is text-only. I'll try to find
 how FreeBSD is configured so that ALT-CTRL-DEL maps to reboot, and
 add my own keyboard key to shut it down.

See the kbdcontrol(1) manpage; the -d and -l options are what you need.
The keyboard(4) manpage sort of describes the layout of the keymap
file.  The full list of actions isn't documented anywhere, but all you
need is 'boot'.

-- 
Dan Nelson
dnel...@allantgroup.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: [6.3] Assigning shutdown to eg. Syst?

2008-12-22 Thread Glen Barber
On Mon, Dec 22, 2008 at 9:31 AM, Gilles gilles.gana...@free.fr wrote:
 Hello

 I'd like to make it easier for my dad to shutdown a server. Instead of
 having him plug a keyboard, log on as root (with a complicated
 password) and finally type shutdown -h now, is it possible to assign
 this command to some unused key like eg. Syst? Even better, send this
 command only if the key is hit eg. three times within 2 seconds?


You could add him to the operator group, which would not require him
to be root.

-- 
Glen Barber
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: [6.3] Assigning shutdown to eg. Syst?

2008-12-22 Thread Ian Smith
On Mon, 22 Dec 2008 20:53:39 +0100 Gilles gilles.gana...@free.fr wrote:
  On Mon, 22 Dec 2008 16:09:02 +0100, Polytropon free...@edvax.de
  wrote:
  I have a similar setting, but it requires X, WindowMaker and a
  Sun Type 6 USB keyboard. :-)

:)

  Thanks for the input, but this server is text-only. I'll try to find
  how FreeBSD is configured so that ALT-CTRL-DEL maps to reboot, and
  add my own keyboard key to shut it down.

Or let your dad login with his own account and password.  Just add him 
to the operator group so that he can run /sbin/shutdown.  If he's shy, 
write him a little script that does 'shutdown -p now [comment ..]'

Shutdown is cleaner than reboot, runs 'stop' rc.d scripts for all active 
daemons, and leaves a nice log entry in messages, including any comment.

cheers, Ian
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: [6.3] Assigning shutdown to eg. Syst?

2008-12-22 Thread Robert Huff

Ian Smith writes:

  Or let your dad login with his own account and password.  Just
  add him to the operator group so that he can run /sbin/shutdown.

If that's the only priveledged command he needs ... is there a
reason sudo isn't a better answer?


Robert Huff


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: [6.3] Assigning shutdown to eg. Syst?

2008-12-22 Thread Ian Smith
On Tue, 23 Dec 2008, Robert Huff wrote:
  Ian Smith writes:
  
Or let your dad login with his own account and password.  Just
add him to the operator group so that he can run /sbin/shutdown.
  
   If that's the only priveledged command he needs ... is there a
  reason sudo isn't a better answer?

Well, it's certainly another answer :)

The only other thing being in group operator lets you run, apart from 
what you've added into /etc/devfs.{conf,rules} is /sbin/mksnap_ffs ..

cheers, Ian
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org