Chrome Kiosk mode on Ubuntu 18.04 LTS

As of 18.04, X11 server requires root priv to run. This made Chrome kiosk mode to complain if you run Chrome as root too. Previously, the whole X11/Chrome was running as a unprev user. Here is the service unit, and starting Chrome as normal user.

UPDATE: 2023-01-10 Chrome became not-liked app in Ubunte, and Firefox has a kiosk mode too. Switching to Firefox

[Unit]
Description=Kiosk Web Browser
After=dbus.target network.target sound.target network-online.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=30
User=root
ExecStart=/usr/bin/startx /etc/X11/Xsession /usr/local/bin/kiosk.sh --

[Install]
WantedBy=multi-user.target

And here is /usr/local/bin/kiosk.sh

#!/bin/bash
xset -dpms
xset s off
xhost + localhost SI:localuser:
sudo -H -u  DISPLAY=$$DISPLAY openbox-session &
sudo -H -u  DISPLAY=$$DISPLAY start-pulseaudio-x11
while true; do
  sudo -H -u  rm -rf /home/triage/.{config,cache}/google-chrome/
  sudo -H -u  google-chrome --display=$$DISPLAY --kiosk --no-first-run 'http://localhost'
done