Results 1 to 10 of 11
Hi All,
I have to make a script to shutdown in Kubuntu (it's Kubuntu-desktop installed on top of Ubuntu...shutdown buttons missing). I forget how to make a script call for ...
- 11-10-2009 #1
script to call for sudo password
Hi All,
I have to make a script to shutdown in Kubuntu (it's Kubuntu-desktop installed on top of Ubuntu...shutdown buttons missing). I forget how to make a script call for sudo password (since shutdown requires sudo user if you do it from a command line). Thanks allBodhi 1.3 & Bodhi 1.4 using E17
Dell Studio 17, Intel Graphics card, 4 gigs of RAM, E17
"The beauty in life can only be found by moving past the materialism which defines human nature and into the higher realm of thought and knowledge"
- 11-10-2009 #2
I use pekwm, which doesn't handle shutdowns, so I put a couple of menu entries as so
EDIT: Forgot to say there is also kdesu instead of gksu/do.Code:gksudo /sbin/shutdown -h now gksudo /sbin/reboot
Last edited by reed9; 11-10-2009 at 11:13 AM.
- 11-10-2009 #3
I would just configure sudo to not need a password for your user when you run the shutdown and reboot commands.
I'm not on the machine I have it set up on, but it should be something like this
Code:jmadero ALL=(ALL) NOPASSWD:/sbin/shutdown -h now,/sbin/reboot
- 11-10-2009 #4This still requires you to call sudo, though, it just means it doesn't ask for authentication.I would just configure sudo to not need a password for your user when you run the shutdown and reboot commands.
You can also get fancy and send a message to HAL to shutdown.
Code:dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Reboot
- 11-10-2009 #5
well thank you both but, still not quite getting it:
I've tried just making a basic file which runs "gksudo shutdown -h now", it never requests a password, shows it trying to do something then stops.
I'd like not having to put in password so coopstah, your solution seems good, where to I put line that you posted?
I think that this is a bug but in launchpad I think they've determined it's not...so weird that if you install Ubuntu and then Kubuntu-desktop on top of it (I like having both....let's me try new things
) you don't get shutdown options in KDE, you only get logout options...
Bodhi 1.3 & Bodhi 1.4 using E17
Dell Studio 17, Intel Graphics card, 4 gigs of RAM, E17
"The beauty in life can only be found by moving past the materialism which defines human nature and into the higher realm of thought and knowledge"
- 11-10-2009 #6You put that in /etc/sudoersI'd like not having to put in password so coopstah, your solution seems good, where to I put line that you posted?
Use visudo to edit
Code:sudo visudo
Try it with kdesu instead of gksudo.I've tried just making a basic file which runs "gksudo shutdown -h now", it never requests a password, shows it trying to do something then stops.
- 11-10-2009 #7
thanks, working on it now, kdesu does the same thing, clock thing spins for a few seconds, shows "shutdown" (name of my launcher) in the task bar, then it goes away, never asks for a password....does this seem like a bug to you? Not having a shutdown option in my KDE setup?
Bodhi 1.3 & Bodhi 1.4 using E17
Dell Studio 17, Intel Graphics card, 4 gigs of RAM, E17
"The beauty in life can only be found by moving past the materialism which defines human nature and into the higher realm of thought and knowledge"
- 11-10-2009 #8
I think it has something to do with the session manager, consolekit, and dbus.
In your other post, you never answered, are you still using GDM for the login manager, or KDM?
I know in Arch, when not using KDM or GDM, you have to start the desktop with ck-launch-session gnome-session or ck-launch-session startkde to properly connect to consolekit, or the shutdown/reboot buttons don't appear. But I'm not sure that works in Ubuntu.
- 11-10-2009 #9
I actually completely forgot about that post! lol that's what I get for doing too many things at once.
For my login manager....I'm not too sure. I thought that they both use the same login manager (nothing changed after I installed kubuntu-desktop)...so if I had to guess it would be GDM login manager, but if I login as jmadero it automatically loads KDE, while my other users auto go into GnomeBodhi 1.3 & Bodhi 1.4 using E17
Dell Studio 17, Intel Graphics card, 4 gigs of RAM, E17
"The beauty in life can only be found by moving past the materialism which defines human nature and into the higher realm of thought and knowledge"
- 11-10-2009 #10
If you do
it should prompt you to choose your login manager. Select KDM and see if that solves the problem. If it doesn't, I would guess kdm is not installed. In which caseCode:sudo dpkg-reconfigure gdm
Code:sudo apt-get install kdm


Reply With Quote