Autologin for kiosk systems
I have a nice computer that is connected to a touch screen. For this to nicely work I wanted to automatically start a Xwindows session and to automatically login a user. Furthermore, I wanted it to start some programs automatically as well.
When searching on the internet I learned that the most recommended option is to use GDM for this. However, my software setup is really minimal and GDM would be a bit to much for it. When installing GDM on Debian you will receive a lot of Gnome packages with it. Of course, I do not need those Gnome packages as I use openbox as my windowmanager. Now I have found and deployed an alternative way to achieve this and I would like to enlight others (and after I forgot about it myself again) how I did it. I found the info on this website.
Let us follow the step plan to make it happen.
I assume that you have a Debian installation that is finished. That a user can type startx and then is presented with a working Xwindows session. That there is a safe/secure user that may do a autologin without being harmful for the computer.
Personally I will use the openbox windowmanager (already installed) and my script will start iceweasel/firefox (already installed).
To enable the autologin feature we need a small and simple tool from the Debian repository:
apt-get install mingetty
Now we have to edit the /etc/inittab. Open it in your favourite editor and change:
#2:23:respawn:/sbin/getty 38400 tty2 2:2:respawn:/sbin/mingetty --autologin username tty2
Thus; mingetty will take care of the autologin of the user with the name username.
Now this is take care of we will take a look how to start the Xsession.
3. Start Xwindows
For this we edit the /home/username/.bashrc file. The file may look like you want, but at the end you should add the following:
set DISPLAY=:0.0 if [ $(tty) == /dev/tty2 ]; then echo "starting X ..." ./.xloop fi
As you can see, the .bashrc file now points to another file. Therefore create the file /home/username/.xloop. In this file we put the following:
#!/bin/bash while true do xinit sleep 33 done
Also make sure that the .xloop file is executable:
chmod a+x /home/_username_/.xloop
4. Start programs
To automatically start programs after the automated login we will have to change again another file. Open /home/username/.xinitrc and make it contain:
#!/bin/bash # Write here the programs you want to autostart, but make sure you put an "&" at the end xterm& firefox my-home-site.net& # Now start your window manager openbox
And again make sure that the .xinitrc file is executable:
chmod a+x /home/_username_/.xinitrc
5. Kiosk mode in iceweasel/firefox
Just use one of the plugins, for example r-kiosk.