2

How can I prevent users from changing the desktop wallpaper on Ubuntu 18.04?

Zanna
  • 72,312

2 Answers2

3

You can't prevent users from changing your desktop background without preventing your own account from making a change. If they are using your account, they have the same access that you have.

Solution 1:

Give them their own separate login ID. This way your environment will never be affected their settings.

Solution 2:

Activate a script that will check for a change and periodically change it back to your preferred background.

You can find an example of such a script in this answer:
How can I get one wallpaper for each day of the week?

Instead of having the script change daily, just have it periodically set the background to your choice.

L. D. James
  • 25,444
1

Yes you can. You need to enforce dconf read-only lock on the background property. I assume you use gnome shell or any destop than use dconf.

So create a file /etc/dconf/profile/user with the content

user-db:user
system-db:local

This defines a user dconf db -which is always defined anyway, but also define a system db that we will use to lock the key we want.

Now create the directory /etc/dconf/db/local.d. This is where reside the keyfile you want to set.

But to lock key, you need to create also /etc/dconf/db/local.d/locks directory. now in that directory any file with a key will be locked.

So create /etc/dconf/db/local.d/locks/00_wallpaper with the content:

# prevent changes to the wallpaper
/org/gnome/desktop/background/picture-uri

Now run sudo dconf update

Then users can't change the wallpaper anymore !

solsTiCe
  • 9,515