6

I know how to change privacy settings via GUI (System Settings > Security & Privacy), but I'd like to be able to do it from command line.

What I did to find out

I ran the command:

dconf watch /

to see what changes were made. About the command (from man dconf):

watch
    Watch a key or directory for changes.

Subsequently, I changed settings via GUI to see what happened in the output of the command. It showed:

/org/gnome/desktop/privacy/remember-recent-files false
/com/canonical/unity/lenses/remote-content-search 'none'
/org/gnome/desktop/screensaver/ubuntu-lock-on-suspend false
/org/gnome/desktop/screensaver/lock-enabled false

My question is: how can I use this information to change the settings from command line?

5
  • So your goal is to alter those dconf schemas you got in the output of dconf watch / ? Apr 8, 2016 at 0:22
  • my goal is to learn how to change the GUI settings in command line. Apr 8, 2016 at 0:48
  • that's a broad topic . There's a lot of things that change the settings, not just one tool . Since that's such a broad topic, you probably won't receive an answer on that. However those specific settings that you've listed can be changed with dconf write KEY VALUE . see askubuntu.com/q/22313/295286 and askubuntu.com/q/487206/295286 for some info . Apr 8, 2016 at 0:59
  • Hi blowfishhgpg, could you mention if the answer is what you are looking for, and if you manage? Apr 8, 2016 at 22:02
  • Great! But I can't manage to disable the diagnostics sent to Canonical. Are these keys not in dconf? At least watch doen't show anything
    – Janning
    Mar 23, 2017 at 17:28

1 Answer 1

10

Different ways to edit those settings

The settings you mention are stored in the dconf database in ~/.config/dconf (in binary format). This database can either be directly edited with dconf, or via gsettings. The difference is explained at the last section of this answer.

Once you have the information, posted in your question, you can therefore change the corresponding settings in two different ways.
Using your first example (setting remember-recent-files):

using dconf write:

dconf write /org/gnome/desktop/privacy/remember-recent-files false

or

using gsettings set:

gsettings set org.gnome.desktop.privacy remember-recent-files false

Similarly, reading the current setting:

using dconf read:

dconf read /org/gnome/desktop/privacy/remember-recent-files

or

using gsettings get:

gsettings get org.gnome.desktop.privacy remember-recent-files

In the first case, you edit the dconf database directly, in the latter you are using gsettings, which is a CLI frontend to dconf.

Which way to prefer; dconf or gsettings?

To protect the integrity of your dconf database, in general, it is considered better practice to use gsettings.

Frome this link, we read:

The dconf program can perform various operations on a dconf database, such as reading or writing individual values or entire directories. This tool operates on dconf directly, without using gsettings schema information. Therefore, it cannot perform type and consistency checks on values. The gsettings(1) utility is an alternative if such checks are needed. You can see gsettings as the cli-frontside to dconf.

Read more on gsettings and dconf.

1
  • They don't seem to be alternatives: I wonder why I can't access to /apps/... with gsettings Mar 19, 2020 at 5:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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