How can I prevent users from changing the desktop wallpaper on Ubuntu 18.04?
-
3Give them a separate login ID from yours. Just about anything else would involve crippling the system. It would help if we understood the wallpaper problem... or why it's a problem. As long as they are using your account, they will have all the same access and control that you have. The question might best be asked, how to stop you from being able to change your desktop background. – L. D. James May 09 '18 at 11:36
-
1@L.D.James That's not a comment! That's an answer! Enter it and ping me and I'll come back to upvote... :-) – Fabby May 09 '18 at 18:38
2 Answers
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.

- 25,036
-
There is a new answer posted 2 hours after yours you might be interested in reading. – WinEunuuchs2Unix May 10 '18 at 00:18
-
@WinEunuuchs2Unix Yes, I read it. I'll look forward to a comment from the OP. I didn't get the impressing that he was trying to also lock himself from being able to make changes. That's why I gave him an alternate solution whereas he could retain his favorite background. If I'm wrong, I guess he has his reasons. He might not realize the burden he places on the users who see colors and shades differently than him. – L. D. James May 10 '18 at 01:32
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 !

- 9,231
-
not working for me on 18.04 ... is
user-db:user
supposed to beuser-db:<username>
? – ether_joe Sep 23 '19 at 20:20 -
1