Media auto-mount can be disabled by using following methods.
For CentOS/RHEL 7
To disable it per user
1. Open dconf-editor and goto org > gnome > desktop > media-handling and uncheck automount and automount-open checkbox on right hand side pane.
2. 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
1. 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
2. After creating the file, apply the changes using below command :
# dconf update
For CentOS/RHEL 6
To disable it per user
1. Open System -> Preferences -> File Management Preferences -> Media. Disable the automount option here.
2. 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
For CentOS/RHEL 5
To disable it per user
1. Open System->Preferences->Removeable Drives and Media Preferences. Disable the automount option here.
2. 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