Last active
October 6, 2025 23:05
-
-
Save zackbradys/1ec72227b8c6dee2c82a49541c39fd42 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # create kiosk user | |
| sudo useradd -m kiosk | |
| sudo passwd -d kiosk | |
| # install packages | |
| sudo apt update | |
| sudo apt install -y --no-install-recommends gnome-session-flashback gdm3 firefox ssh curl tree vim xdotool | |
| # setup ssh | |
| sudo systemctl enable --now ssh | |
| sudo sed -i 's/^#\?PasswordAuthentication .*/PasswordAuthentication yes/' /etc/ssh/sshd_config | |
| sudo ufw allow 22 | |
| # configure gdm for auto-login | |
| sudo tee /etc/gdm3/custom.conf > /dev/null << EOF | |
| [daemon] | |
| AutomaticLoginEnable=true | |
| AutomaticLogin=kiosk | |
| EOF | |
| # create kiosk session script directory | |
| sudo mkdir -p /home/kiosk/.local/bin | |
| # main kiosk script | |
| sudo tee /home/kiosk/.local/bin/gnome-kiosk-script > /dev/null << 'EOF' | |
| #!/bin/sh | |
| # /home/kiosk/.local/bin/gnome-kiosk-script | |
| # disable X11 screen blanking and power saving | |
| xset s off | |
| xset s noblank | |
| xset -dpms | |
| # disable GNOME idle timeout and screensaver | |
| gsettings set org.gnome.desktop.session idle-delay 0 | |
| gsettings set org.gnome.desktop.screensaver idle-activation-enabled false | |
| gsettings set org.gnome.desktop.screensaver lock-enabled false | |
| # start gnome flashback session | |
| export XDG_CURRENT_DESKTOP=GNOME-Flashback | |
| export GDK_BACKEND=x11 | |
| gnome-session --session=gnome-flashback-metacity & | |
| # wait for X to be ready | |
| until xset q >/dev/null 2>&1; do sleep 1; done | |
| sleep 5 | |
| # clean firefox entirely each restart | |
| rm -rf /home/kiosk/.mozilla/firefox /home/kiosk/.cache/mozilla/firefox | |
| mkdir -p /home/kiosk/.mozilla/firefox | |
| chmod -R 700 /home/kiosk/.mozilla | |
| chown -R kiosk:kiosk /home/kiosk/.mozilla | |
| # launch firefox in kiosk mode with multiple tabs | |
| /usr/bin/firefox --kiosk \ | |
| "https://ieacro.com/welcome" \ | |
| "https://ieacro.com/today" \ | |
| "https://ieacro.com/trial-students" \ | |
| "https://ieacro.com/upcoming-events" \ | |
| "https://ieacro.com/contact" & | |
| # wait for firefox and zoom it | |
| sleep 5 | |
| WIN_ID="" | |
| until [ -n "$WIN_ID" ]; do | |
| WIN_ID=$(xdotool search --onlyvisible --class "Firefox" | head -n 1) | |
| sleep 1 | |
| done | |
| xdotool windowactivate "$WIN_ID" | |
| xdotool key ctrl+plus | |
| xdotool key ctrl+plus | |
| xdotool key ctrl+plus | |
| # start tab rotation | |
| /home/kiosk/.local/bin/rotate-tabs.sh & | |
| # restart firefox by the set interval | |
| while true; do | |
| sleep 900 | |
| pkill firefox | |
| sleep 5 | |
| rm -rf /home/kiosk/.mozilla/firefox /home/kiosk/.cache/mozilla/firefox | |
| mkdir -p /home/kiosk/.mozilla/firefox | |
| chmod -R 700 /home/kiosk/.mozilla | |
| chown -R kiosk:kiosk /home/kiosk/.mozilla | |
| /usr/bin/firefox --kiosk \ | |
| "https://ieacro.com/welcome" \ | |
| "https://ieacro.com/today" \ | |
| "https://ieacro.com/trial-students" \ | |
| "https://ieacro.com/upcoming-events" \ | |
| "https://ieacro.com/contact" & | |
| # wait for firefox and reapply zoom | |
| sleep 5 | |
| WIN_ID="" | |
| until [ -n "$WIN_ID" ]; do | |
| WIN_ID=$(xdotool search --onlyvisible --class "Firefox" | head -n 1) | |
| sleep 1 | |
| done | |
| xdotool windowactivate "$WIN_ID" | |
| xdotool key ctrl+plus | |
| xdotool key ctrl+plus | |
| xdotool key ctrl+plus | |
| done | |
| EOF | |
| # tab rotation script | |
| sudo tee /home/kiosk/.local/bin/rotate-tabs.sh > /dev/null << 'EOF' | |
| #!/bin/bash | |
| export DISPLAY=:0 | |
| export XDG_RUNTIME_DIR="/run/user/$(id -u kiosk)" | |
| while true; do | |
| WIN_ID=$(xdotool search --onlyvisible --class "Firefox" | head -n 1) | |
| if [ -n "$WIN_ID" ]; then | |
| xdotool windowactivate "$WIN_ID" | |
| xdotool key --window "$WIN_ID" ctrl+Tab | |
| fi | |
| sleep 7 | |
| done | |
| EOF | |
| # permissions | |
| sudo chmod +x /home/kiosk/.local/bin/gnome-kiosk-script | |
| sudo chmod +x /home/kiosk/.local/bin/rotate-tabs.sh | |
| sudo chown -R kiosk:kiosk /home/kiosk/.local | |
| # register session with gdm | |
| sudo mkdir -p /usr/share/xsessions | |
| sudo tee /usr/share/xsessions/gnome-kiosk-script.desktop > /dev/null << EOF | |
| [Desktop Entry] | |
| Name=Kiosk Mode | |
| Comment=start firefox in kiosk mode with tab rotation | |
| Exec=/home/kiosk/.local/bin/gnome-kiosk-script | |
| TryExec=/home/kiosk/.local/bin/gnome-kiosk-script | |
| Type=Application | |
| EOF | |
| # tell AccountsService to use the session | |
| sudo mkdir -p /var/lib/AccountsService/users | |
| sudo tee /var/lib/AccountsService/users/kiosk > /dev/null << EOF | |
| [User] | |
| Session=gnome-kiosk-script | |
| SystemAccount=false | |
| EOF | |
| # set graphical as default boot target | |
| sudo systemctl set-default graphical.target | |
| # reboot into kiosk mode | |
| sudo reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment