busybox.conf fixes shutdown
May 01, 2011 —
BarryK
Continuing from previous blog post:
http://bkhome.org/archive/blog2/201104/introducing-39fido39.html
In Wary I now have the suid bit set in /bin/busybox, but apparently that does not mean all the applets can run as root when invoked by a non-root user. In the case of 'reboot', 'poweroff' and 'halt' they won't run.
There is a solution though, a "poor man's sudo", that allows permissions to be set on a per-applet basis. Busybox has to be configured with CONFIG_FEATURE_SUID_CONFIG. I have done this and uploaded the PET. Compiled in Wary, but should work in other puppies (368K):
http://distro.ibiblio.org/quirky/pet_packages-wary5/busybox-1.17.2-1-w5.pet
My script /usr/sbin/root2user now creates /etc/busybox.conf, that allows 'reboot' and 'poweroff' to be run by fido.
The contents of /etc/busybox.conf is explained here:
http://www.softforge.de/bb/suid.html
...can't say that I really understand that 'ssx' field yet!
A distro that uses Busybox is Slitaz, and they also use this mechanism:
http://www.slitaz.org/en/doc/scratchbook/base-system.html
I can now shutdown. Other things still broken though (audio for example), will tackle those soon.
Comments
missing root2userUsername: L18L
would be nice to have that script too. It is not in the pet so /etc/busybox.conf is empty
No sound
Username: BarryK
"Hmmm, I can't get sound to work. I am using the same technique as kirk in FatDog64, all audio device nodes are dynamically created, with some udev rules. This, as I understand it, should create audio device nodes with root:audio ownership: [i]SUBSYSTEM=="sound", GROUP="audio"[/i] Kirk has USER="spot" GROUP="spot". However, for me the device nodes get created root:root. Well, I will download latest FatDog64, see if that works for as I expect.
Re FatDog64
Username: BarryK
"Um, I did download FatDog64, but then realised I don't have a PC with 64-bit CPU. :cry:
Re sound
Username: L18L
"Not sure whether this is helpful but maybe useful as [b]testing scenario[/b]. seamonkey file:///usr/share/audio/2barks.au using browser as spot. 2barks heard. Or in console # whoami root # ps | grep seamonkey 16555 spot 0:00 /bin/sh /usr/bin/seamonkey -UILocale de 16588 spot 0:00 /bin/sh /usr/lib/seamonkey/run-mozilla.sh /usr/lib/seamonk ey/seamonkey-bin -UILocale de 16592 spot 0:20 /usr/lib/seamonkey/seamonkey-bin -UILocale de 19175 root 0:00 grep seamonkey # su spot # whoami spot # cat /usr/share/audio/2barks.au > /dev/audio # same good result, heard it loud and clear. My regards spot on wary503q
Tags: woof