Debian This forum is for the discussion of Debian Linux.
|
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
03-11-2011, 07:46 AM
|
#1
|
|
Member
Registered: Mar 2010
Location: Western Maine
Distribution: PCLinuxOS (LXDE)
Posts: 467
Rep:
|
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.
|
|
|
|
03-11-2011, 07:51 AM
|
#2
|
|
Member
Registered: Jan 2010
Location: Inland PNW
Distribution: VLocity | antiX-13
Posts: 233
Rep:
|
Ctrl-Alt-Del
Eat fish once in awhile (lol)
Last edited by hilyard; 03-11-2011 at 07:53 AM.
|
|
|
|
03-11-2011, 07:54 AM
|
#3
|
|
Member
Registered: Apr 2005
Posts: 890
|
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.
|
03-11-2011, 08:03 AM
|
#4
|
|
Member
Registered: Mar 2004
Distribution: Debian
Posts: 279
Rep:
|
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()
|
|
|
|
03-11-2011, 08:34 AM
|
#5
|
|
Member
Registered: Mar 2010
Location: Western Maine
Distribution: PCLinuxOS (LXDE)
Posts: 467
Original Poster
Rep:
|
Quote:
Originally Posted by Caravel
|
Exactly what I needed, thank you. 
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:10 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|