Ubuntu server 16.04 kiosk mode

This is example for firefox.
First you need install ubuntu server.
Reconfigure time zone if you need it

sudo dpkg-reconfigure tzdata

Install updates

sudo apt update
sudo apt upgrade

Install X and firefox without recomendations

sudo apt install --no-install-recommends xorg openbox pulseaudio firefox -y

I don’t know how to use sysd and new xserver-xorg that’s why I would use sysv and xserver-xorg-legacy 🙂

sudo apt-get install upstart-sysv xserver-xorg-legacy -y

Now we need to create new user and add him to audio and video groups

sudo adduser kiosk
sudo usermod -a -G audio kiosk
sudo usermod -a -G video kiosk

If you would work with any serial device you need to add this user to dialout group

sudo adduser kiosk dialout

Now we need to create start script

sudoedit /opt/kiosk.sh
#! /bin/bash
xset -dpms
xset s off
openbox-session &
start-pulseaudio-x11
while true; do
        /usr/bin/firefox
done

Don’t forget to allow run that script

sudo chmod +x /opt/kiosk.sh

Now we need to run that script on startup

sudoedit /etc/init/kiosk.conf
start on (filesystem and stopped udevtrigger)
stop on runlevel [06]

console output
emits starting-x

respawn

exec sudo -u kiosk startx /etc/X11/Xsession /opt/kiosk.sh --

And reconfigure Xwrapper

sudoedit /etc/X11/Xwrapper.config
allowed_users=anybody
needs_root_rights = yes

If you want to use nodewebkit app you need to install additionals packages

sudo apt-get install libnss3-dev libcups2-dev libgconf2-dev libxss-dev libatk1.0-dev libgtkglextmm-x11-1.2-dev

After that you should update grub

sudoedit /etc/default/grub

You need to update following lines

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

And now

sudo update-grub
sudo reboot now

That’s it.

But don’t forget that maybe you would need:

  • If your kiosk would use keyboard you need to block special keyboards keys
  • Setup iptables
  • Update sshd config
  • Disable boot from another devices in bios
  • Setup bios password
Запись опубликована в рубрике Linux. Добавьте в закладки постоянную ссылку.

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *