How to disable media automount in GNOME

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 9
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 5
  • GNOME

Issue

  • How can I disable the cd/dvd automount feature in GNOME?
  • How to disable automount of removable media in GNOME ?

Resolution

Media auto-mount can be disabled by using following methods.

RHEL 7, RHEL 8, RHEL 9

To disable it per user:

  • Open dconf-editor and goto org > gnome > desktop > media-handling and uncheck automount and automount-open checkbox on right hand side pane.
  • Alternatively, use the command below :

    # gsettings set org.gnome.desktop.media-handling automount false
    # gsettings set org.gnome.desktop.media-handling automount-open false 
    # systemctl restart gdm.service
    

To disable it for all users :

  • Create a file /etc/dconf/db/local.d/00-media-automount with following content:

    # cat /etc/dconf/db/local.d/00-media-automount
    [org/gnome/desktop/media-handling]
    automount=false
    automount-open=false
    
  • After creating the file, apply the changes using below command :

    # dconf update
    

RHEL6

To disable it per user:

  • Open System->Preferences->File Management Preferences->Media .
  • Alternatively, use the command below:

    $ gconftool-2 --type bool --set /apps/nautilus/preferences/media_automount false
    $ gconftool-2 --type bool --set /apps/nautilus/preferences/media_automount_open false
    

To disable it for all users :

  • Run the command below:

    # gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory -s /apps/nautilus/preferences/media_automount -t bool false
    # gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory -s /apps/nautilus/preferences/media_automount_open -t bool false
    

RHEL5

To disable it per user:

  • Open System->Preferences->Removeable Drives and Media Preferences .
  • Alternatively, use the command below:

    $ gconftool-2 --type bool --set /desktop/gnome/volume_manager/automount_drives false
    $ gconftool-2 --type bool --set /desktop/gnome/volume_manager/automount_media false
    

Comment

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments