Instructables

Setting Up Ubuntu as a Kiosk Web Appliance

Featured
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
    * Subsonic Guest Interface
    * X10 House Control
 
Remove these adsRemove these ads by Signing Up

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

Fullscreen capture 6282010 40850 PM.bmp
Fullscreen capture 6282010 40935 PM.bmp
Fullscreen capture 6282010 41108 PM.bmp
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

Picture of 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

Picture of Set up Kiosk Desktop Mode in Xsessions
Fullscreen capture 6282010 45401 PM.bmp
Fullscreen capture 6282010 45507 PM.bmp
Fullscreen capture 6282010 45523 PM.bmp
Fullscreen capture 6282010 45605 PM.bmp
Fullscreen capture 6282010 45734 PM.bmp
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

Picture of 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.
chuydb1 year ago
Made it back by runnig a terminal...then

sudo nano /etc/lightdm/lightdm.conf

and deleting the autologin user line.
natrinicle (author)  chuydb1 year ago
Excellent! Glad you figured it out. Thanks for posting the answer!
sitoto1 month ago

Great instructable. I was successful in installing and configuring everything and I can boot in Kiosk Mode. My question is; is there anything else i need to install as a receiver? in order to make the touch screen working, because now my touch screen mouse is just bouncing around and not clicking anything.

natrinicle (author)  sitoto1 month ago
It really depends from screen to screen. Is it a USB screen? If so, please run lsusb -v and paste the output into a pastebin and shoot me a link. Otherwise, get me the make and model and I'll see if anyone's got any advice online (when it doubt, Google it).
godzilla8nj3 months ago

You might be interested in Sanickiosk. It's a simple-to-use, completely free, totally customizable web kiosk I built. You can download an ISO or run a script against a fresh Ubuntu Server installation. The entire system can be customized and administrated through the browser. http://links.sanicki.com/sanickiosk

balno11 months ago
Great instructable. I've recently installed some computers as described in our local library and it works like a charm ! Thanks thanks thanks ! By the way, the part of the script used for setting the initial window size didn't work here, I used this one instead :

-------------------------------------------------------------------------------------------------------------
#!/bin/bash

# we get screen resolution

res=$(xrandr -q | awk -F'current' -F',' 'NR==1 {gsub("( |current)","");print $2}')
resx=$(echo $res | awk '{split($0,array,"x")} END{print array[1]}')
resy=$(echo $res | awk '{split($0,array,"x")} END{print array[2]}')

# starting xscreensaver

xscreensaver -nosplash &

while true;
        do chromium-browser %u --incognito --window-size=$resx,$resy
        sleep 5s;
done




--------------------------------------------------------------------------------------------------------------
Thanks again for the good work.

François. (Agneaux. France)
balno balno11 months ago
as you can see, window size isn't saved anywhere here, it is set by a flag on the command line used to run chromium.
natrinicle (author)  balno11 months ago
Beautiful code! Thanks for the update on that!
scottdn1 year ago
Excellent instructable. I was successful in configuring everything and the Kiosk is working as expected except for one minor issue. While in the kiosk the mouse pointer displays a black X as opposed to a white pointer. What is causing this and how can it be resolved?
natrinicle (author)  scottdn1 year ago
That's the default X Cursor, it looks like you can change it by following the instructions Beastie explains here: http://forums.freebsd.org/showthread.php?t=27920
Like the instructable but what in the world made you think lcd screens would not burn in????
natrinicle (author)  ghostbust5551 year ago
I accounted for that, hence the xscreensaver installation and portion of the script.
noob2ub1 year ago
Does anyone know the correct way to get my kiosk screen to go full screen? I tried many of the methods on this site and I still have a 1/2 inch of uncovered screen at the bottom of my kiosk. My settings are 1000 bottom and 1280 right. Any help is greatly appreciated.
nmartin121 year ago
I GOT IT!!!! Once logged into kiosk I navigated in the file browser to the files I created and executed kiosk.desktop. Now chrome launches the kiosk when started as a regular program from the sidebar (unity launcher)
nmartin121 year ago
Ok so I redid the two lines in the bash file to fix the issue but chromium will not autostart or even start in kiosk mode for that other user. I am at a loss as to why. I have redone the steps several times and copy pasted to prevent typos.
natrinicle (author)  nmartin121 year ago
Can you check who the script is owned by and what the permissions on it are by running an "ls -al" in the terminal while in the same directory as the script?
nmartin121 year ago
I even thought about reworking the chromeKiosk.sh file. Though I have no Idea exactly how any of the scripting works yet. I am running 12.04 if that changes anything, I noticed some steps don't exist anymore.
rpace19061 year ago
Thank you for posting this! I found it useful. You wouldn't happen to know anything about bell - merivale would you? Any insight would be great!
natrinicle (author)  rpace19061 year ago
No problem rpace1906. I'm afraid the only things I know about Bell is what I can Google on it. I live in the U.S., not Canada.
chuydb1 year ago
Im using ubuntu 12.04 LTS, finllay got working the kiosk with autologin. Couple of things, how do I switch back? If I force reboot the autologin gets me right back to the kiosk mode, hence I cant do anything.

chuydb chuydb1 year ago
Been playing around with the terminal to see if i could force out of the kiosk, still nothing.
Clr361 year ago
Where might I have gone, followed the directions but now even when using the admin or master account it loads the kiosk mode? Now I can't change any setting. Thanks
natrinicle (author)  Clr361 year ago
You will need to edit the ~/.dmrc file's Session= line. I use KDE by default on my system (not loaded with standard Ubuntu) and my line is Session=kde-plasma.
Just guessing, but I think if you set that line to Session=gnome that it should go back to the gnome desktop for you.
mrazem2 years ago
Is there a way to force Chrome or Chromium start in Full-Screen mode?
natrinicle (author)  mrazem2 years ago
You have to use the xrandr super long command in the chromeKiosk.sh creation step. From what I understand the file that the resolution is stored in has changed locations as well and I haven't had a chance to look at and repair that script. If you can find the location of the file you should be able to just change the file name in those two commands.
Hi, thanks for your quick response but that did not work, Is anybody experiencing the same situation. i guess there is no way to gain access to the Pc from this other than a re build of the Ubuntu Os.
Those settings for fullscreen are now located in ~/.config/chromium/Default/Preferences

width=`xrandr | grep \* | head -n1 | cut -d' ' -f4 | cut -d'x' -f1`
height=`xrandr | grep \* | head -n1 | cut -d' ' -f4 | cut -d'x' -f2`

echo $width,$height

cat ~/.config/chromium/Default/Preferences | perl -pe "s/\"work_area_bottom.*/\"work_area_bottom\": $height,/" > /tmp/tmp.$$
cp /tmp/tmp.$$ ~/.config/chromium/Default/Preferences
cat ~/.config/chromium/Default/Preferences | perl -pe "s/\"bottom.*/\"bottom\": $height,/" > /tmp/tmp.$$
cp /tmp/tmp.$$ ~/.config/chromium/Default/Preferences
cat ~/.config/chromium/Default/Preferences | perl -pe "s/\"work_area_right.*/\"work_area_right\": $width,/" > /tmp/tmp.$$
cp /tmp/tmp.$$ ~/.config/chromium/Default/Preferences
cat ~/.config/chromium/Default/Preferences | perl -pe "s/\"right.*/\"right\": $width,/" > /tmp/tmp.$$
mv /tmp/tmp.$$ ~/.config/chromium/Default/Preferences

mikefoes1 year ago
I have re built the system in case i had missed something in the set up. But it is exactly the same. The kiosk works fantastically only allowing users use of the web browser, but I can't gain access to the admin user as the settings are in force here. I log on as my admin user but no access to any menu's etc. if you could find the time to point me in the right direction it would be very helpful.

great tutorial, easy to follow and very informative.

best regards

mike
natrinicle (author)  mikefoes1 year ago
After intensively searching the internet, I finally found the config file that tells GDM which desktop environment to load. You will need to edit the ~/.dmrc file's Session= line. I use KDE by default on my system (not loaded with standard Ubuntu) and my line is Session=kde-plasma.
Just guessing, but I think if you set that line to Session=gnome that it should go back to the gnome desktop for you.
mikefoes1 year ago
when switching to the Administrator the kiosk mode is still active, no menus etc, how do i over come this as i want to change some settings for the restricted user
.
regards

mike
mikefoes1 year ago
Tutorial is well thought out and explained exceptionally with the Ade of the screen shots. However Chromium wont start automatically on the users account, could you point me in the wright direction what to look for. I entered the script as shown. i am new to linux and this a great project to get me started.

also is there a way of disabling the Gnome panel for the user, I just want to really lock the system down.

best regards

mike
natrinicle (author)  mikefoes1 year ago
I would check the .desktop file creation step and make sure that the correct file permissions are set. This will take care of disabling the Gnome panel as well.
natrinicle (author)  natrinicle1 year ago
Step 6 actually, sorry I didn't include it in my last comment
nhoncoop1 year ago
I have almost everything working (great tutorial!), only the webpage is faster than the internet connection, what results in a page cannot found message. So I have to wait for just 2 a 3 seconds hit F5 and it is working but is there a better solution?

Also i did something wrong and it is not possible to go back to the normal login screen so i can login as administrator or user in unity? I use ubuntu 12.04.
natrinicle (author)  nhoncoop1 year ago
Thanks! I'm guessing it's probably that you're using DHCP and that the DHCP server is taking too long to hand out an address. You can set a static address and that should help.

My guess on the user is in step 7 not having set a time that you can log in as another user before the auto login. Unfortunately, I'm not sure where this is set so I don't know how to unset it.
I have installed Ubuntu again but I can't find the Login Screen Settings in Ubuntu 12.04. Is ther another way to set some time to login as an another user? I have tried to fix it in in the lightdm.conf but both versions login in the default interface without some time to login as someone else.

1
[SeatDefaults]
autologin-user=user
autologin-user-timeout=20
autologin-session=Kiosk Mode
user-session=Kiosk Mode
greeter-session=unity-greeter
allow-guest=false

2
[SeatDefaults]
autologin-user=user
autologin-user-timeout=20
user-session=ubuntu
greeter-session=unity-greeter
allow-guest=false
natrinicle (author)  nhoncoop1 year ago
Looks like Ubuntu changed their greeter to LightDM which is what you're trying to set here. If it's not accepting the config file then you might need to file a bug with the developers. I believe at the time I wrote this article they were using GDM.
I found a alternative gdm greeter tool called MDM (http://askubuntu.com/questions/143192/how-can-i-replace-lightdm-with-mdm). In MDM is it possible to Timed Login, what fixed the problem.
matais2 years ago
Hi, iv followed your brilliant guide and works perfecty with chromium but iv altered it for Opera and only having one issue getting it full screen (you can see the background, round the sides of the opera window), with Chromium i managed to drag the windows to full screen and it holds even after a reboot but with Opera i cant seem to do the same or find another way of doing it, any help would be greatly appricated, iv attached an image of what im getting
photo.JPG
natrinicle (author)  matais2 years ago
I haven't tried Opera yet, but a quick Google search has led me to the Opera Kiosk Mode documentation. I quickly glanced through it and it appears that there are a series of command line options to set the screen height and width. Take a look at the following url for more info: http://www.opera.com/support/mastering/kiosk/
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!