How to build an Internet kiosk using Mandriva Linux and Firefox
This is a quick document to remind me how to set up an Internet kiosk for public usage. Many thanks to James D. B. for his invaluable insights that he has posted at http://jadoba.net/PLUG/kiosks/howto/. This is not a Mandriva specific document - it should port quite smoothly to pretty much any Linux distro out there.
Here you should pretend to read the usual disclaimers about how you can trash your system and ruin your life, and it's your own darn fault for following advice you found on the Internets. Disregard the warnings like we all do, and carry on knowing that if something goes wrong it's all your fault, blah, blah, blah, etc., etc..
Ok, here we go!
First, load up a base install of Mandriva on your hardware.
Add a 'kiosk' user.
Set up Firefox as outlined in the howto referenced above.
I could not get Xwrapper to work correctly on Mandriva - it complained about console ownership and I couldn't figure out how to get around it. So like a proper Internet denizen, I routed around the issue thus:
For the kiosk user, I enabled autologin via the getty process:
edit /etc/inittab, and change the line:
1:2345:respawn:/sbin/mingetty tty1 --autologin kiosk
I then added the following 2 lines to /home/kiosk/.bashrc:
Those lines start a basic X session, which launches firefox as defined in my .xinitrc, and exit the shell when X is stopped (I don't want anyone to be able to switch over to console 1 after killing off X and have a happy little shell sitting there waiting for them). The exit will kill the shell off, and restart mingetty, thusly restarting the autologin process and relaunching X and Firefox. Pretty slick, eh? :)
Finally, I chattr +i the necessary files in /home/kiosk (such as .bashrc and .xinitrc) to make them un-modifiable.
I modified /etc/inittab to require a password in single user mode (mostly useless since if you can get to single user mode, you've gotten into the boot loader and you can simply say init=/bin/bash, but I did it in the interest of completeness.
You can require a password at the single user mode prompt by adding the following line to /etc/inittab:
I also set a password on the Grub boot loader (and may I just take this opportunity to say I HATE Grub! It's ugly as hell, poorly documented and bloated. Give me LILO and leave it at that!!! Why, oh why, Mandriva did you ditch good ol' LILO for this travesty of a boot loader?):
as root, run grub-md5-crypt and type your password. If you're all the way booted up you can just cut n' paste the encrypted output, or if you aren't, then run it thusly:
grub-md5-crypt >> /boot/grub/menu.lst
Type in your bootloader password twice, and then fire up your editor and edit /boot/grub/menu.lst.
Remove the "Type your password" lines, then put password --md5 in front of the encrypted password.
Then (and this is the poorly documented part), move this line to just below the global timeout line. If it's below the image line then the damned thing won't boot at all without a password.