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 want to be able to change the default background (wallpaper) for all new accounts. Not enforce it after that, but it should be on as default choice. I need to do this on 12.04 with unity and I need to be able to do it from the shell (as it will be installed through a package). Any ideas?

share|improve this question
did you mean this:… ? so overwrite the one in /usr/share/backgrounds/ or did you want to create your own dvd that does this like this:… ? (ie. are new accounts on the same system or are new accounts also a new computer?) – Rinzwind May 19 '14 at 8:40
Hi, thanks for the suggestion. Not exactly, I do pxe installs and after installation I install a home-brewed debian package that will create a xml file and properly add it to 12.04s backgrounds, it will aslo set the bg for the current user. Problem is that it seems it only affects the current user (the one that runs the package). When the xml file is in place and the picture is copied, the postinst in the debian package runs "gsettings set org.gnome.background picture-uri". And all that works as said but unfortunately only for the user installing the package. – user278762 May 19 '14 at 11:17
up vote 0 down vote accepted

I've done this using gsettings for GNOME3, simply having a package with



for example (I'm guessing similar mechanisms exists for xfce and kde as well, though you might have to explicitly install the override there..).

And then making sure that the package installs this background in that location via


my-background.png usr/share/my-background-package

and storing the image as my-background.png in the root of the package source.

share|improve this answer
Hi, thanks for the example. My debian package contains a xml file and the wallpaper along with the "gsettings set org.gnome.desktop.background picture-uri file://blabla.jpg". When run it works as intended for the user running the pkg. the wallpaper is added to the wallpaper list and the wallpaper is set for current user. It just isn’t working for any new accounts, they still get the default bg. Seems we are more or less doing the exact same, is yours working for newly created accounts/ accounts that has never been logged in before? – user278762 May 19 '14 at 11:21
Yes. The above method results in the binary package installing the gsettings-override file as /usr/share/glib-2.0/schemas/10_my-package.gschema.override which should be a system-wide override of the default setting. – arand May 19 '14 at 13:19
Ok, i see, thanks. Did you just put the override file there or did you too had to use glib-compile-schemas for it to work? It didnt work until i run that. – user278762 May 20 '14 at 8:23
Running glib-compile-schemas is taken care of by dpkg triggers, (see /var/lib/dpkg/info/libglib2.0-0\:amd64.triggers and /var/lib/dpkg/info/libglib2.0-0:amd64.postinst) so the package should only need to dump the file into the correct location (and for gsettings override, the dh_* packaging tools takes care of placing it in the correct location, as well), – arand May 20 '14 at 13:00
Thanks for that, ill have a look at the triggers. – user278762 May 20 '14 at 13:30

gsettings set org.gnome.desktop.background picture-uri file://<path_to_pic>
Run it once on the computers in question.

share|improve this answer
Thanks for you suggestion, that will only work for the current user it seems. When I ran that, other users, both ad users and local ones did not get the new background set. – user278762 May 19 '14 at 11:08
Assuming their identity with something like sudo is not an option? – dizzi90 May 19 '14 at 13:05
I already read their name before executing in the postinst with logname cmd. However, that will not help for other users/ users not created yet, as this will only affect the current user. – user278762 May 20 '14 at 7:20

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.