Skip to content

Auto login without Display Manager and single X program Kiosk

Sreejith I V edited this page Mar 13, 2024 · 1 revision

A single X client can be run in kiosk mode without the need of a display manager and a full blown Desktop Environment. We will be using firefox as the x client here.

Auto login

Auto login can be implemented on the client to login to the TTY automatically without user interaction. From there we can use xinit to start firefox in kisok mode. This essentially results in a seamless boot from power-on to the target website on Firefox with zero user interaction. For this to work, we need:

  • Auto login with agetty using systemd drop-in file on the client OS
  • Auto login for LTSP client, configured on the server OS
  • A user for the clients to auto log in to, created on the server OS

The first one alone cannot take us to the Firefox window since without proper SSHFS/NFS mount, there is no .xinitrc for startx to use.

The second one alone won't technically "auto-login" the user, it just wait for the user to press enter on the login screen and hence we need user interaction.

  • systemd drop-in file (To be placed inside the client OS image):

/etc/systemd/system/getty@tty1.service.d/autologin.conf

[Service]
ExecStart=
ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin username %I $TERM

replace username with the username we want to auto-login

  • For LTSP auto login, create the ltsp.conf file at /etc/ltsp/ltsp.conf using
install -m 0660 -g sudo /usr/share/ltsp/common/ltsp/ltsp.conf /etc/ltsp/ltsp.conf

After that, add the following code to the [client] section of ltsp.conf

[*]                            # Wild card to catch all clients
HOSTNAME=client                # host name for clients
PASSWORDS_client=user/cm9vdA== # username/base64 encoded password
AUTOLOGIN=user                 # enables autologin for the above user

*replace client with a hostname for the clients and user with the user that we want to auto login. Password for the user should be converted to base64. Can use any tool for this conversion (Simple websites exists).

  • Regenerate image and initrd
ltsp image <image name>
ltsp initrd

Full screen X

Without a window manager to manage the window size, we might see black bars on some sides of Firefox, This is because Firefox assumes the best resolution when it spawns its window. To change this behavior, we can pass in -height and -width arguments when executing Firefox, that way, Firefox starts up in the specified resolution. But how do we find out what resolution is best for the current monitor?. We can use a program called xdpyinfo which is bundled with xorg to find the best resolution of the current monitor and do some shell scripting to extract the height and width of the monitor. The final .xinitrc script will be:

resolution="$(xdpyinfo | awk '/dimensions/{print $2}')"
height="$(echo $resolution | cut -d 'x' -f2)"
width="$(echo $resolution | cut -d 'x' -f1)"
exec firefox -height "$height" -width "$width" -kiosk https://mozilla.org

replace https://mozilla.org with target website link