Show Table of Contents
9.5. Configuring Custom Default Values
Machine-wide default settings can be set by providing a default for a key in a
dconf profile. These defaults can be overridden by the user.
To set a default for a key, the
user profile must exist and the value for the key must be added to a dconf database.
Example 9.1. Set the Default Background
- If it does not already exist, create the
userprofile in/etc/dconf/profile/user:user-db:user system-db:local
where local is the name of adconfdatabase. - Create a keyfile for the local database in
/etc/dconf/db/local.d/01-background, which contains the following default settings:# dconf path [org/gnome/desktop/background] # GSettings key names and their corresponding values picture-uri='file:///usr/local/share/backgrounds/wallpaper.jpg' picture-options='scaled' primary-color='000000' secondary-color='FFFFFF'
In the default setting of the keyfile, the following GSettings keys are used:Table 9.1. org.gnome.desktop.background schemas GSettings Keys
Key Name Possible Values Description picture-options "none", "wallpaper", "centered", "scaled", "stretched", "zoom", "spanned" Determines how the image set by wallpaper_filename is rendered. picture-uri filename with the path URI to use for the background image. Note that the backend only supports local (file://) URIs. primary-color default: 000000 Left or Top color when drawing gradients, or the solid color. secondary-color default: FFFFFF Right or Bottom color when drawing gradients, not used for solid color. - Edit the keyfile according to your preferences. For more information, see Section 9.3, “Browsing GSettings Values for Desktop Applications”.
- Update the system databases:
#dconf update
Important
When the
user profile is created or changed, the user will need to log out and log in again before the changes will be applied.
If you want to avoid creating a
user profile, you can use the dconf command-line utility to read and write individual values or entire directories from and to a dconf database. For more information, see the dconf(1) man page.
9.5.1. Locking Down Specific Settings
The lockdown mode in
dconf is a useful tool for preventing users from changing specific settings.
To lock down a
GSettings key, you will need to create a locks subdirectory in the keyfile directory (for instance, /etc/dconf/db/local.d/locks/). The files inside this directory contain a list of keys to lock, and you may add any number of files to this directory.
Important
If you do not enforce the system settings using a lockdown, users can easily override the system settings with their own. Any settings users have made will take precedence over the system settings unless there is a lockdown enforcing the system settings.
The example below demonstrates how to lock settings for the default wallpaper. Follow the procedure for any other setting you need to lock.
Example 9.2. Locking Down the Default Wallpaper
- Set a default wallpaper by following steps in Section 10.5.1, “Customizing the Default Desktop Background”.
- Create a new directory named
/etc/dconf/db/local.d/locks/. - Create a new file in
/etc/dconf/db/local.d/locks/00-default-wallpaperwith the following contents, listing one key per line:# Prevent users from changing values for the following keys: /org/gnome/desktop/background/picture-uri /org/gnome/desktop/background/picture-options /org/gnome/desktop/background/primary-color /org/gnome/desktop/background/secondary-color
- Update the system databases:
#dconf update

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.