Setup A Kiosk With Ubuntu and Chromium - O'Brien Labs
Setup A Kiosk With Ubuntu and Chromium - O'Brien Labs
(/)
HOME (/) WEATHER WEBSITE (HTTPS://GO.OBRIENLABS.NET/BELCHERTOWN)
PORTFOLIO (/PORTFOLIO) SEARCH (/SEARCH) ABOUT (/ABOUT) CONTACT
(/CONTACT)
Home (/) » Tech Tips (/categories/#Tech Tips) » Setup a Kiosk with Ubuntu and
Chromium
I also show how I’ve set this up for a Raspberry Pi. (https://obrienlabs.net/setup-raspberry-
pi-kiosk-chromium/) It’s mostly the same, but a few things are different. Check it out if you
have a Raspberry Pi that you want to automate a display with!
The first thing I did was get Ubuntu 16.04 Desktop installed. This worked for me with
Ubuntu 14.04 as well. Once you have that installed, and sudo apt-get update && sudo
apt-get upgrade to the latest and greatest, then move onto the next step.
Create 2 users. One user is already created – the account you’re logged in as. For this we’ll
assume the account name is obrienlabs. Create a second user named kiosk. This will
become the auto-logged in user.
The other account will be used to manage the system and any kiosk changes remotely via
SSH. If you SSH into this machine as the kiosk user, you’ll end up running duplicate scripts.
I chose to add the 2 users to the sudoers file so I wouldn’t get prompted for passwords all
the time. Run visudo and at the bottom add
Now we can setup the auto login process. We need the user Kiosk to auto login on every
reboot.
sudo nano /etc/lightdm/lightdm.conf and add:
[SeatDefaults]
autologin-user=kiosk
autologin-user-timeout=0
user-session=ubuntu
greeter-session=unity-greeter
[SeatDefaults]
autologin-user=kiosk
Now that we are auto logged in, let’s run our script.
[Desktop Entry]
Type=Application
Name=Kiosk
Exec=/home/kiosk/kiosk.sh
X-GNOME-Autostart-enabled=true
Installing the kiosk.sh script is as simple as copying the code below. This script will be
launched every time the kiosk user logs in (even with SSH), so be sure to tailor it to your
needs!
#!/bin/bash
# Start the kiosk loop. This keystroke changes the Chromium tab
# To have just anti-idle, use this line instead:
# xdotool keydown ctrl; xdotool keyup ctrl;
# Otherwise, the ctrl+Tab is designed to switch tabs in Chrome
# #
while (true)
do
xdotool keydown ctrl+Tab; xdotool keyup ctrl+Tab;
sleep 15
done
As you can see Chromium runs in Kiosk mode. This means it’ll go full screen and take
minimal input from the keyboard and mouse (if one was plugged in). In this example,
Chromium will auto load Google and Bing in 2 tabs, and xdotool will cycle between the tabs
every 15 seconds. I’m also performing some Chrome clean up in case the system reboots
without closing Chrome. This will remove the nag bar.
Managing the system after it’s setup
To manage the system after it’s setup, you’ll need to find the IP of the device, and SSH into it
using the OTHER USER you setup. Do not SSH in as user kiosk, or you’ll end up opening
another Chromium instance, as well as kiosk.sh which will end up changing the tabs in more
frequent intervals since xdotool will be called twice as fast.
Other things you can add to kiosk.sh are running x11vnc and autossh to automatically
setup an SSH tunnel from the system to your centralized server, allowing you to SSH into
the device and even VNC to the monitor without needing to know the IP. Very useful!
If you make any changes and want to log Kiosk out without rebooting, I’ve found that this
command works. This will kill the kiosk.sh script and restart the Windows service which will
log out and log in the kiosk user.
Ubuntu Unity UI allows you to press the Windows key on the keyboard to open the
launcher. Once the launcher is open, type terminal. Once in the terminal type sudo
killall chromium-browser or press Alt+F4 to close Chromium.
The kiosk.sh script will still be running, this script has the xdotool keydowns running (see
above). We need to kill that too with sudo killall kiosk.sh. To remove it all
together, refer to the above to remove the /home/kiosk/.config/autostart/kiosk.desktop file.
That’s basically it! A quick way to get a Kiosk setup which shows multiple tabs of
information.
I hope this helps someone, and if you have any suggestions on improvements, let me know in
the comments!
You can start your DigitalOcean Ubuntu server for as low as $5/mo and be online in 1
minute. Best yet, if you use this link you get $10 credit for free
(https://go.obrienlabs.net/digitalocean)!
(https://go.obrienlabs.net/digitalocean)
Disclosure: Some of the links on this website are affiliate links. This means that, at zero cost
to you, I will earn an affiliate commission if you click through the link and finalize a purchase.
5 Responses
w
p/w💬
/o
lw
:p
s.th
t( www.oliprat.com (https://www.oliprat.com/wp_sita_C/2019/05/20/kiosque/): (menti…
o//💬
y
b :p
stht( geekyboi.co.uk (https://geekyboi.co.uk/tech/happy-frappe-pi-latte/): (mention)
e//💬:p
stht( askpythonquestions.com (https://askpythonquestions.com/2021/01/14/build-a-slee…
//💬:p
stht( receipt.techniciansalaryslip.com (https://receipt.techniciansalaryslip.com/auto-login-…
//💬:p
stht( letterflat.com (https://letterflat.com/login/auto-login-lubuntu/): (mention)
22 Comentarios
I have it working! Thank you for the massive Help. But i have one
little Problem, the Chromium window wont go Fullscreen until i click on it.
But I would prefer to not have any Kind of HID. Is there any way of getting
automatic Fullscreen?
Responder
While the chromium is running , and then can i press any key to kill
it ? Example: I press 'ctrl+shift+x' to kill the chromium, and if it can
shutdown PC, it''s specially for me, Thanks
Responder
Hi, when i boot the system it will not log in automatically into the desktop...i can see
the welcome screen and a raspi login: _ text appear...Can you help me in this case?
here my steps i did the install on a raspian lite stretch..
dann
1.sudo apt-get update && sudo apt-get upgrade 2.sudo -i // mit root Rechten arbeiten
5.useradd kiosk
6.visudo
7.//at the buttom at kiosk ALL=(ALL) NOPASSWD: ALL pi ALL=(ALL) NOPASSWD: ALL
8.reboot
1. Installing the kiosk.sh (http://kiosk.sh) script is as simple as copying the code below.
#!/bin/bash
I strongly suggest to remove the "kiosk" user from sudoers. This account should be
as restricted as possible.
Responder
I would agree if this kiosk had a keyboard/mouse attached to it. But if it's
for a wallboard with no real HID then it shouldn't pose a huge risk, no? If you'd like
to recommend a workaround, let me know.
Responder
hi pat i tried to change the default zoom percentage in chromuim but each time my
url its launched with your app , the chromuim browser dont use my zoom
percentage set up by default before
Responder
Hi robby, what do you mean you changed the zoom percentage? In Chrome
so the website is bigger? That is not controlled by my script.
Worked magically for me. However, I could actually do "Ctrl+Shift+W" and exit the
browser and expose the underlying OS for me to do anything including run terminal
and systems settings. I guess there should be a security layer on this as well.
Responder
Anyone found Solution to rotatie the screen? Can i use Xander or is this only for
gnome?
Responder
Hi Pat,
Thanks for tutorial. Got small problem. My starting website is login page to the portal where
cant type nothing on keyboard. Checked if there is any problem with website but not, it is
working on root acount. Thanks for help.
Rafal
Responder
Frederick • hace 5 años
Hi,
ALl is working for me but I want to rotate the screen. ANyone know how to do?
Rgds, Fred
Responder
Hello sir, i just Setup Kiosk with Ubuntu 16.04 and Chromium 62.0. it setup
successfully with create new user called "Kiosk". but problem is that when kiosk.sh
(http://kiosk.sh) script running it will show warning like that "unclutter: someone created a
sub window to my sub-window! giving up". and one more thing when the script(kiosk.sh
(http://kiosk.sh)) is running then cycle between the tabs or any other editor screen it will
move up very fast. how can i disable the cycle. can we do like person manually changes the
tab in Chromium browser.? can you please help me to solved the problem?
Thanks.
Responder
I'm not sure about that unclutter error - never seen that before! For the
kiosk.sh (http://kiosk.sh) question, if you log in via SSH or anything as the kiosk
user it'll run multiple kiosk.sh (http://kiosk.sh) files. Which means it'll make more
and more timers to switch tabs. Your fix there is to create another user account
and log in as that and never log in as the kiosk user. That way you only have 1
kiosk.sh (http://kiosk.sh) running in the background.
Responder
suryaprakash (http://orientlabs.net) • hace 5 años
all ok,but i had error like this "unclutter : could n't open display (null)" .pls help me
to clear from d error....
Responder
Hi Pat,
Thanks for getting back to me. I figured out where I went wrong - I created the kiosk.sh
(http://kiosk.sh) file using a sudo nano, rather than just nano. By doing so, it gave that file
root permissions and when I went to issue the chmod, I had to sudo it as well. Your
procedure is fantastic - I'd recommend if you wanted to add the command (nano
/home/kiosk/kiosk.sh (http://kiosk.sh)) to create the script file for dummies that me that
follow paint by numbers, that would likely save anyone else the same headaches I had. To
overcome my error, I just added a call for the script in crontab and it worked, but that was a
kludge. Doing a clean install and following your process (without my sudo error!) worked
the first time. Thanks again.
Rocky
Responder
Hi Pat, Thanks a ton for taking the time to create this tutorial. I want to achieve the
same result and there's something missing along the way as I can't get it to boot up
running the script. The script works - I call it from the terminal and I get a full-screen,
Chromium browser. But when I reboot, it launches into my root user - not the 'kiosk' one
and it goes downhill from there. I have tried other pages to change the autostart functions
but now I'm pretty close to crippled hardware (which is fine in getting these things going) so
I'm going to reinstall Ubuntu from scratch and try again. I know you're not looking for tech
support inquiries with these posts, but if you have a chance, I'd appreciate your insight. I'll
leave my contact info in the fields below and I'd love to pick your brain for 5 mins if possible.
I'll make sure you get a beer for your trouble!
Thanks.
Responder
Hi Pat, Wonderful and easy tut!! I tried experimenting it and it actually helped me.
Thanks Pat
Responder
Copyright © 2010–2022 O'Brien Labs – All Rights Reserved – Use without permission is illegal.