Originally Posted by
wrrr
hello. try this. add this line to
/etc/sudoers
Code:
%users localhost=NOPASSWD:/sbin/reboot, /sbin/poweroff
this makes possible to any user from the
users group to invoke
sudo reboot or
sudo poweroff without the need of typing in root password.
lastly, make a change in
~/.bash_profile as such:
Code:
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
startx; sudo poweroff;
fi
for me it works like a charm. btw. I don't use any of the xDMs (have GDM in my Debian/Etch installed but disabled), just terminal login with the autologin feature created according to the how-to found in this topic.
the effect is: when I invoke "log off" from gnome menu, the xserver shuts down and the
sudo poweroff command is executed automaticlly (no need to give root password).
btw. anyone could tell me what are the drawbacks of my solution?
looks okay to me, i do mine a little different(using debian+xfce4).no compiling needed, i apt-get mingetty. "user" is my login name.
Code:
my sudoers line:
%nopasswd ALL=(root) NOPASSWD: /usr/bin/conky, /sbin/halt, /sbin/reboot, /sbin/shutdown, /usr/sbin/xfsm-shutdown-helper, /usr/bin/thunar, /usr/bin/mousepad, /usr/sbin/synaptic
Code:
my login line(/etc/inittab):
1:2345:respawn:/sbin/mingetty tty1 --autologin user
Code:
bash_profile:
if [ `tty` = "/dev/tty1" ]; then
startx
fi
Bookmarks