5

I want to set the 'automount' key, for the ‘media-handling’ schema, to ‘false’, for all users on a single desktop machine.

I can do this individually, i.e. one user at a time, by using gsettings whilst logged-in as the specific user:

gsettings set org.gnome.desktop.media-handling automount false

To do this for each individual account, however, is somewhat arduous. I would like to set the same key to ‘false’ in a global fashion, so that the desired behaviour is observed globally, across all user accounts.

Using locate media-handling I have located the following ‘xml’ file:

/usr/share/glib-2.0/schemas/org.gnome.desktop.media-handling.gschema.xml

The file contains the following:

<schemalist gettext-domain="gsettings-desktop-schemas">
  <schema id="org.gnome.desktop.media-handling" path="/org/gnome/desktop/media-handling/">
    <key name="automount" type="b">
      <default>true</default>
      <summary>Whether to automatically mount media</summary>
      <description>If set to true, then Nautilus will automatically mount media such as user-visible hard disks and removable media on start-up and media insertion.</description>

I understood the files located here to be universal/global, and that any changes to these files, would affect all users globally. However, setting the value here to ‘false’ as no observable effect.

I have also found this answer and created the equivalent ‘override’ file:

/usr/share/glib-2.0/schemas$ ls | grep media-handling
org.gnome.desktop.media-handling.gschema.override.xml
org.gnome.desktop.media-handling.gschema.xml

..with the content:

[org.gnome.desktop.media-handling]
automount=”false”

I ran sudo glib-compile-schemas /usr/share/glib-2.0/schemas/ as instructed in the given answer, however there has been no observable effect. Why is this, assuming the given solution is correct?

How do I set the 'automount' key to ‘false’, in such a manner that it configures all user accounts? Once this is achieved, how do I prevent individual users from configuring their own account differently to the global rule?

Secondly, how does the system use the file /usr/share/glib-2.0/org.gnome.desktop.media-handling.gschema.xml, as my understanding would lead me to think it alters all user accounts, given its location in ….share/glib-2.0.. , however this is not the case?

(Ubuntu 16.04)

  • org.gnome.desktop.media-handling.gschema.override.xml the man page says this should be nn_*.gschema.override where nn are digits to indicate precedence. Also try glib-compile-schemas with the --dry-run switch which should report errors. – pbhj May 17 '18 at 21:09
  • 1
    @pbhj thank you. You are right. However, I have altered this as appropriate and it has not affected any changes; - - dry - run does not return anything. I'm at a complete loss. – Andrew Hardiman May 19 '18 at 15:33
0

Do not get me wrong, but I think that here exists simpler way than editing XML-files.

You can use dconf-based profiles.
I have read about it in RedHat documentation:

Below is rough example for your problem:

sudo mkdir -p /etc/dconf/profile

cat <<EOF | sudo tee /etc/dconf/profile/user
user-db:user
system-db:local
EOF

sudo mkdir -p /etc/dconf/db/local.d

cat <<EOF | sudo tee  /etc/dconf/db/local.d/00-my
[org/gnome/desktop/media-handling]
automount=false
EOF

sudo dconf update
  • 1
    thank you for your answer. However, this still does not work for me. /etc/dconf/profile contains the file ibus. This is a text file consisting of the following: user-db:user \ system-db:ibus. I have therefore created the following file in /etc/dconf/db/ibus.d/01-upstream-settings. The file contains the following: [org/gnome/desktop/media-handling] \ automount=false. I then run sudo dconf update but to no avail. Any ideas? – Andrew Hardiman May 18 '18 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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