Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've done a lot of googling but haven't been able to find a solution to my problem.

I am a teacher and I'm using Xubuntu on some student computers. I have everything locked down pretty good, but I can't figure out how to restrict users from changing the wallpaper without having to out the whole machine in Kiosk mode. I don't care if they change it during their work session, but I would like to create a crontab that resets back to the original .png at reboot.

I'm hoping for a simple cron entry but I'm willing to ease into the world of shell scripts if that's what it takes.

Any ideas?

share|improve this question

In Xfce land, that's

xfconf-query --channel xfce4-desktop --property /backdrop/screen0/monitor0/image-path --set /usr/share/backgrounds/xfce/xfce-blue.jpg

(Substitute the file path you want, of course.)

xfconf-query --channel xfce4-desktop --list

lists all related properties, in case screen0/monitor0 isn't the one.

share|improve this answer
When I run that in the command line, it works like a charm. When I try to add it to cron though, it doesn't do anything. Any ideas? ` – John Nov 22 '13 at 4:10
How about enclosing the whole thing in a shell script and run the shell script using cron instead? – Chester Nov 22 '13 at 5:21
Created the shell script and made it executable. It runs when double clicked and I can run it in the command line. I tried adding it to cron with @reboot as the time but it doesn't seem to be working. Do I need to add something to cron other than just the path to the script? – John Nov 22 '13 at 12:28
@John It doesn't work in cron because cron work under root privilege and this is a user specific background. try changing the command to run as your user – kamil Feb 13 '14 at 17:06
You need to set the DESKTOP environment variable if you want to use it in a cron job. If you only have one X server running you could just do: DESKTOP=:0 xfconf-query ... in your cron job. – Bugster May 3 '15 at 1:10


gsettings set org.gnome.desktop.background picture-uri file:///your/picture/location.jpg

The file:// is required.

share|improve this answer
I tried it without any luck. Since I'm running XFCE, do I even have gsettings? The syntax of the command makes sense to me, but I don't know how to make it apply to Xubuntu. – John Nov 22 '13 at 1:50

Don't use cron. Instead use the startup script. Although you can use cron but I don't prefer it in this situation because it is user specific.

Do it this way:

sudo vi /etc/rc.local

add the following at the end of file

sudo -u YOURUSERNAME -g $( id -g YOURUSERNAME ) xfconf-query --channel xfce4-desktop --property /backdrop/screen0/monitor0/image-path --set /usr/share/backgrounds/xfce/xfce-blue.jpg

and make sure you replace YOURUSERNAME with your current user. And replace /usr/share/backgrounds/xfce/xfce-blue.jpg by the real path of the new background image and make sure your user has permission to read the image

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.