Setting Up Ubuntu As a Kiosk Web Appliance

397,148

103

202

Published

Introduction: Setting Up Ubuntu As a Kiosk Web Appliance

At work we have the frequent need for a machine that will allow students to access the internet without having full access to a computer.  To accomplish this task we previously resorted to creating AutoHotKey scripts on a Windows XP machine.  Many of the students and the staff who monitored these computers took issue with the computer's slow boot and running speed.  To cope with this we started to explore alternatives to Windows.  This is where we combined Ubuntu (a fast operating system) with Chromium-browser (one of the fastest browsers).  Now we have really old machines running as web kiosks that boot in 20 seconds or less and are very responsive to clicks, typing, and even flash videos and animations.

Follow the steps in this Instructable to set up Ubuntu, and Chromium if you haven't already.

Some potential uses for this type of system:
    * Web Kiosk
    * Information Booth
    * SubsonicGuest Interface
    * X10 House Control

Step 1: Add XScreensaver & Ubuntu Restricted Extras

On our systems we found that even LCD monitors got burnt in after time.  They are not supposed to be able to do this, but they were.  To remedy this, we tried to get the default screensavers to come up.  They were not great at running from a script.  Instead the best option for this is to install the xscreensaver packages.  I like to do this from the command line so click Applications, highlight Accessories, and click Terminal.  From there enter the command "sudo apt-get install xscreensav* -y" without the quotation marks.  The asterisk at the end allows aptitude to install all of the packages that start with xscreensav, thus installing all the additional screensavers available.
If you will be using flash you will need to install the plugin for it.  The best way I've found to do this is similar to adding xscreensaver.  In the terminal window enter "sudo apt-get isntall ubuntu-restricted-extras -y".  Once this is done close the Terminal window.

Step 2: Create a Basic User

You will want a restricted user for the end users to use that does not have sudo access and cannot change system settings.  This way the Web Kiosk cannot be compromised as easily.  To do this click System, then highlight Administration, and click Users and Groups.  Once there click add, type your password to get past the authentication window, and input a generic username (I used Scholar).  To set up the account set a basic password for now and click ok.  You will want to click the Advanced Settings button in the lower right side of the window and choose the User Privileges tab.  From there uncheck all the check boxes that you do not want users to be able to access.  Then you can close the Users Settings window.

Step 3: Set Up XScreensaver

Once your new user has been created, log out of your regular user and log into the restricted user account.  Next run XScreensaver's configuration window for the first time so that it will create the necessary configuration files.  You can find this configuration window by clicking System, highlighting preferences, and finally clicking the top Screensaver option.  If you hover over it, it should read "Change Screensaver Properties".  The XScreensaver will then ask you a few questions about disabling Gnome Screensaver and starting it's own Daemon, just click ok to all of these questions.  You can set which screensaver's you would like to see by checking the box to the left of the screensaver's name.  The option that says blank the screen after really stands for how long you want it to wait before starting that screensaver.  The option just below it is for how long before it changes from one screensaver to the next.  I like to let mine start after 10 minutes and change every 2 minutes.

Step 4: Set Up Chromium

Log into the restricted account you created in the previous step and start chromium-browser. Click on the wrench on the upper right of the chrome window, and then choose Options. In the first tab that comes up, input the home page that you would like to show up. Then click on the Personal Stuff tab and choose to never save passwords and to disable autofill.  After this click on the Under the Hood tab and click Clear Browsing Data.  Then check all the check-boxes and choose Everything from the period selection drop-down box.  Click Clear Browsing data, after this is done close all the Chromium windows.

Step 5: Never Save History Again

After closing Chromium click Places, and then click Home Folder from the top bar.  From the resulting window click View and then Show Hidden Files.  You should now be able to see a folder called ".config", open this, find chromium, and open the Default folder.  Right click on the file called Preferences and choose Open with gedit.  Then scroll to the bottom and find the option "exited_cleanly": and set it to true if it isn't already.  Save and close this file in gedit.  Go up a folder by clicking the chromium button near the top of the white file space.  Right click on the file named "Local State" and make sure that the lines that start with "top": and "left": both have zeros after them and before the commas.  Then right click on the Default folder, select Properties, and click on the Permissions tab.  Select Access files from the Folder Access drop down box at the top of the properties window, then select Read-Only from the File Access drop down box just under the top one.  Click close once these options have been set, then close the File Browser.  Open Chromium once more and make sure that all of the settings appear to be correct and that the history does not show up for newly visited webpages.

Step 6: Set Up Kiosk Desktop Mode in Xsessions

Next you'll need to switch back to your regular user so that you can use sudo once again.  Once in the regular user account, click Applications, Accessories, and Terminal.  On the command line type: "sudo gedit /usr/share/xsessions/kiosk.desktop"  Then in the resulting window insert this code:

[Desktop Entry]
Encoding=UTF-8
Name=Kiosk Mode
Comment=Chromium Kiosk Mode
Exec=/usr/share/xsessions/chromeKiosk.sh
Type=Application

Save and close this document and then insert the following command on the Terminal window: "sudo gedit /usr/share/xsessions/chromeKiosk.sh"  This should bring up another gedit window for you to insert the following code:

#!/bin/bash
xscreensaver -nosplash &
cat ~/.config/chromium/Local\ State | perl -pe "s/\"bottom.*/\"bottom\": $(xrandr | grep \* | cut -d' ' -f4 | cut -d'x' -f2),/" > ~/.config/chromium/Local\ State
cat ~/.config/chromium/Local\ State | perl -pe "s/\"right.*/\"right\": $(xrandr | grep \* | cut -d' ' -f4 | cut -d'x' -f1),/" > ~/.config/chromium/Local\ State
while true; do chromium-browser %u --start-maximized; sleep 5s; done

If you would like to disallow access to the URL bar simply insert "--kiosk" between %u and --start-maximized as shown in the sixth picture on this step.
A few people commented that the inclusion of the "--incognito" switch at the same place as "--kiosk" goes makes it so that you do not have to worry about making the Chromium user profile read only.

After you have created these two files run "sudo chmod 755 /usr/share/xsessions/chromeKiosk.sh" in order to make this script executable.  See the image notes for more information.

Step 7: Autolog User Into Kiosk Mode

Next up is to allow anyone to log into our generic account and to set up the computer to load this account on startup.  First click System, highlight Administration, and click Users and Groups.  This should bring up a window that shows both accounts available on the system.  Make sure your regular account has the password asked on login so no one else can get in and mess up the system.  Then click on your generic guest user account (Scholar in my case) and click the change button next to the password field.  In the next window that shows up select "Generate random password" and check the box to allow login without asking for the password.  After this is done, close the user settings window.  Next click System, then highlight Administration, and finally click Login Screen.  In the lower right of the Login Screen Settings window that comes up there will be a button that says Unlock.  Click this button and enter your password.  After you click authenticate, the window will allow you to click the different options available.  Select log in as your restricted user allowing 2-5 seconds for anyone else to log in first.  This will allow you to make changes if anything isn't set right in the future.  Also select Kiosk Mode as the default session and click close.

Step 8: Testing

After you are done with everything else, reboot the computer and it should auto login to the restricted user and display Chromium fullscreen.  If you have the --kiosk switch enabled in the chromeKiosk.sh then it should just show the homepage across the whole screen.

If by chance, Google Chromium is not stretched to the edges with the --kiosk switch enabled there is a simple fix.  To stretch Chromium simply log in as your regular user and edit chromeKiosk.sh to not have the --kiosk switch.  Then log in as the restricted user, click the wrench and choose options.  Then on the Personal Stuff tab select Hide system title bar and use compact borders.  Close the options screen and stretch Chromium to fit the monitor.  Then go back into the options window and set it to Use system title bar and borders.  After this is done, log out of your restricted user (might need to just reboot) and log into your regular user.  Edit chromeKiosk.sh back to include the --kiosk switch again and Chromium should be full screen next time you log into the restricted user.

Share

Recommendations

  • Clocks Contest

    Clocks Contest
  • Planter Challenge

    Planter Challenge
  • Woodworking Contest

    Woodworking Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

202 Comments

Made it back by runnig a terminal...then

sudo nano /etc/lightdm/lightdm.conf

and deleting the autologin user line.

3 replies

How did you get to the terminal? CTRL-ALT-T doesn't work for me.

ctrl+alt+t only works while in a window manager. ctrl+alt+f1 or ctrl+alt+f2 should take you to an alternate tty though.

Excellent! Glad you figured it out. Thanks for posting the answer!

hi, this is a great article and just about to attempt to seutp the kiosk desktop. is it possible to use these steps but add our in house developed app instead of Chromium. im new to Ubuntu and slowly learning how to use and setup as i go along, so please go easy on me. the app is saved in the Bin folder.

Thanks in Advance

4 replies

Yeah, you should be able to in step 6 by replacing the chromium line in /usr/share/xsessions/chromeKiosk.sh with your own application.

Hi Natrinicle
would the above work on ubuntu 16.04.1 LTS? or will i have to downgrade or source an alternative method?

To be completely honest, I haven't tried this in years. It might work but I've been tempted to take down the article until I could verify it. I can't imagine the desktop files would have changed that much but there might be a few minor tweaks that need to be discovered.

hi Natrinicle
thanks ever so much for your reply this helps loads and much appreciated. i will try this out shortly
Many thanks :-D

Hi This post is great and know its pretty old now, but i was wandering if these steps can be used to run our in house developed app instead of cromium. ive installed it in the Bin folder. as you can probably tell im new To Ubuntu so please go easy on me :)

Try to use mKiosk firefox plugin - https://addons.mozilla.org/addon/mkiosk/ - Public Firefox Kiosk Mode with optional Tabs Guides for Access Point. Complete solution. Block downloads/addon, bookmarks, reset kiosk inactivity, retry on errors, restricted interface, show favorites as buttons and more...

Cannot get past the last step in Ubuntu 15.04. I cannot find System-> Administration, no longer available. How do I do autologin and apply the kiosk mode as the default session

3 replies

In order to get to System>Administration>Users/Groups you have to install gnome-system-tools in Ubuntu 15.04

sudo apt-get install gnome-system-tools

I know it's a bit off-topic, but still... I think it's unwise to do kiosk on non-LTS version of Ubuntu. LTS stands for Long Term Support, which basically means that you will have 5 years of supported operating system instead of 1 year (or even less) with Standard Edition of it.
More info: https://wiki.ubuntu.com/LTS

Makes perfect sense to use the LTS version. I was able to find the 'Users/Groups'. However, I cannot locate the 'Login Screen Settings'; I will check again to be sure

Finally got it to work.

Chromium does not launch in full screen mode. Any work around?

Thank you for the help, anyway you could make a youtube video guide trying to get it to work on Ubuntu 14.04 but does not boot up into chrome automatically.

3 replies

So you're wanting a video on how to install Ubuntu?

Sorry meant creating a kiosk workstation on ubuntu 14.04 or higher.

Dont have any problem installing ubuntu.

Thank you in advance

For that you'd need to customize to your needs. You could start with a limited user account that automatically logs in but anything beyond that would have to be up to you to decide how you wanted it set up.

Can Anyone please explain this code to me :

running ubuntu got everything working thank you the only two problems I have is :

1. Cant seem to fiqure out how to resize to fill the screen (could you please make a guide)

2. I would like to understand the code below.

#!/bin/bash

xscreensaver -nosplash &

cat ~/.config/chromium/Local\ State | perl -pe "s/\"bottom.*/\"bottom\":
$(xrandr | grep \* | cut -d' ' -f4 | cut -d'x' -f2),/" >
~/.config/chromium/Local\ State

cat ~/.config/chromium/Local\ State | perl -pe "s/\"right.*/\"right\":
$(xrandr | grep \* | cut -d' ' -f4 | cut -d'x' -f1),/" >
~/.config/chromium/Local\ State

while true; do chromium-browser %u --start-maximized; sleep 5s; done

running ubuntu 14.04

Thank you in Advance