LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 03-11-2011, 07:46 AM   #1
eveningsky339
Member
 
Registered: Mar 2010
Location: Western Maine
Distribution: PCLinuxOS (LXDE)
Posts: 466

Rep: Reputation: 51
Reboot/shutdown command without sudo


I've added entries to my Openbox menu labeled Reboot and Shutdown. Problem is, reboot and shutdown h only work as root, and I never login as root.

I've tried su-to-root -c reboot, but the menu entries remain unresponsive.

I do not have sudo installed because I feel it is a security issue. However, I found that sudo reboot works with the menu entry, but only if my account is set to use sudo without a password in /etc/sudoers.

I use tint2 as my panel, but have had no luck with finding a shutdown/reboot button.
 
Old 03-11-2011, 07:51 AM   #2
hilyard
Member
 
Registered: Jan 2010
Location: Inland PNW
Distribution: Lite | siduction
Posts: 291

Rep: Reputation: 66
Ctrl-Alt-Del

Eat fish once in awhile (lol)

Last edited by hilyard; 03-11-2011 at 07:53 AM.
 
Old 03-11-2011, 07:54 AM   #3
cynwulf
Senior Member
 
Registered: Apr 2005
Posts: 2,727

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
I run openbox and tint2 on my old spare laptop. sudo is the best way to do this - in fact this is the kind of stuff that sudo was actually designed for. Follow this guide: http://www.debianuserforums.org/viewtopic.php?f=9&t=216
 
1 members found this post helpful.
Old 03-11-2011, 08:03 AM   #4
rizzy
Member
 
Registered: Mar 2004
Distribution: Debian
Posts: 285

Rep: Reputation: 69
I use Crunchbang linux that has openbox DE preconfigured. Looking through the menu logout config:
Code:
		</item>
		<item label="Exit">
			<action name="Execute">
				<execute>
					openbox-logout
				</execute>
			</action>
		</item>
That takes me to /usr/bin/openbox-logout
This is how that looks like:
Code:
#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk
import os

class DoTheLogOut:

    # Cancel/exit
    def delete_event(self, widget, event, data=None):
        gtk.main_quit()
        return False

    # Logout
    def logout(self, widget):
        os.system("openbox --exit")

    # Reboot
    def reboot(self, widget):
        os.system("gdm-control --reboot && openbox --exit")

    # Shutdown
    def shutdown(self, widget):
        os.system("gdm-control --shutdown && openbox --exit")

    def __init__(self):
        # Create a new window
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_title("Exit? Choose an option:")
        self.window.set_resizable(False)
        self.window.set_position(1)
        self.window.connect("delete_event", self.delete_event)
        self.window.set_border_width(20)

        # Create a box to pack widgets into
        self.box1 = gtk.HBox(False, 0)
        self.window.add(self.box1)

        # Create cancel button
        self.button1 = gtk.Button("_Cancel")
        self.button1.set_border_width(10)
        self.button1.connect("clicked", self.delete_event, "Changed me mind :)")
        self.box1.pack_start(self.button1, True, True, 0)
        self.button1.show()

        # Create logout button
        self.button2 = gtk.Button("_Log out")
        self.button2.set_border_width(10)
        self.button2.connect("clicked", self.logout)
        self.box1.pack_start(self.button2, True, True, 0)
        self.button2.show()

        # Create reboot button
        self.button3 = gtk.Button("_Reboot")
        self.button3.set_border_width(10)
        self.button3.connect("clicked", self.reboot)
        self.box1.pack_start(self.button3, True, True, 0)
        self.button3.show()

        # Create shutdown button
        self.button4 = gtk.Button("_Shutdown")
        self.button4.set_border_width(10)
        self.button4.connect("clicked", self.shutdown)
        self.box1.pack_start(self.button4, True, True, 0)
        self.button4.show()

        self.box1.show()
        self.window.show()

def main():
    gtk.main()

if __name__ == "__main__":
    gogogo = DoTheLogOut()
    main()
 
Old 03-11-2011, 08:34 AM   #5
eveningsky339
Member
 
Registered: Mar 2010
Location: Western Maine
Distribution: PCLinuxOS (LXDE)
Posts: 466

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by Caravel View Post
I run openbox and tint2 on my old spare laptop. sudo is the best way to do this - in fact this is the kind of stuff that sudo was actually designed for. Follow this guide: http://www.debianuserforums.org/viewtopic.php?f=9&t=216
Exactly what I needed, thank you.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to shutdown/reboot server, no shutdown process running dctw Linux - Server 5 03-31-2010 05:46 AM
[FYI] "last -f <old wtmp> -x reboot shutdown" incorrect for last reboot and shutdown catkin Linux - General 1 03-25-2010 11:52 PM
Trying to remove the shutdown reboot button from the command line fcfury Linux - Newbie 1 07-10-2009 09:02 AM
run this command when the computer shutdown or reboot lindylex Debian 4 11-25-2008 04:31 PM
sudo: shutdown: command not found ekdya Fedora 2 09-29-2006 04:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 07:56 PM.

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