Tips Linux Explorers   All Things Linux Forum   Great Linux Links   Hometown   Email 


Making poweroff and reboot buttons

In Slackware when we want to power-off we need to give the command “shutdown -h now” as root in a terminal. ( Because there is no entry for shutdown in the menu  )

We can make a power-off button, but it needs some work, here is how to do that:

We need to edit the sudoers file, as root, with vi ( study the Vi editor before you do this, see notes below ! ). .
There is a special command to open the sudoers file in vi though . . NOT "vi sudoes", but:

# visudo

This will open the file in vi . . so press "i" to put vi in insert mode an paste the next line at the end of the file: ( you need to do this for every user you will allow to reboot and halt )

QUOTE (Text @ Visudo File)
bruno ALL=(ALL) NOPASSWD: /sbin/shutdown -h now, /sbin/reboot

Then save and close the file:

We now gave "bruno" sudo permission to give the commands "sudo /sbin/reboot" and "sudo /sbin/halt" and we can meke special buttons on the tastbar:

Rightclick on the taskbar and choose "Add" --> "Special Button" --> "Non-KDE application" . . you will get a little GUI where you can put in the top box ( Executable ):

sudo /sbin/reboot

. . . and press on the icon to change the icon to the one you like . . then press OK and you are ready . . . Do the same for:
sudo /sbin/shutdown -h now

And every user you did add in the sudoers file will be able to press the buttons and reboot or halt the system.

That should do the trick.

Have FUN


NOTE 1: More about editing with Vi see:  Vi ( Revisited ) Tip

NOTE 2:> The command "visudo" works by default with vi, if you want it to default to nano ( or any other editor ) issue this command: "export EDITOR=nano"

-- Jan 27 2004 ( Revised Dec 14 2005 ) --

Tips Linux Explorers   All Things Linux Forum   Great Linux Links   Hometown   Email