How to disable USB automount?
I've search for an answer to this question but haven't had much luck. I am running CentOS 6.4 and am doing a lot with USB sticks. CentOS conveniently mounts a USB stick that it detects has a formatted file system on it, except that I don't want it to do this. How can I turn off this feature?
|
If you are using GNOME (which is what I know in)
System --> Preferences --> Removable Drives and Media. Here, you can change all the automount settings. Hope that helps! :) |
I use Gnome as well, but there is no "Removable Drives and Media" entry under System Preferences, and nothing that even looks close. Are you using CentOS?
|
I have a Centos VM in the workplace which is what I checked. If you do not have the menu entry, can you try this in a terminal?
Code:
$ gnome-volume-properties |
Hmmm, the closest thing I have is gnome-volume-control, but that's for setting the speaker volume. Are these commands available through a yum package? I did a quick look but nothing seemed to match.
|
If you want to mount usb device, but don’t want to open nautilus automatically every time usb device is inserted, then:
In nautilus,
Disable GNOME Automounting |
I am extremely sorry about this - I missed Centos 6.4! :o
Alternatively, you can potentially use gconf-editor (if I am not mistaken, this time). |
So that's an improvement. After making these changes in nautilus, the file browser no longer opens when I insert USB stick. The drives do continue to auto-mount though, under /media/<id>, just like before. I think this is controlled through something outside of nautilus, a system setting somewhere.
|
Take a look at this link - http://unix.stackexchange.com/questi...-6/74127#74127
|
Hmmm. This talks about how to make something automount that isn't. I need to opposite. It does describe how to configure a new rules.d config to do this, so I might be able to use this same file for disable the automounting. Right now I don't have the rules.d file they describe here, so something else is actually doing the automounting.
|
Is this what you want? To fully disable the gnome automounter?
# gconftool-2 --direct \ --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory \ --type bool \ --set /apps/nautilus/preferences/media_automount false # gconftool-2 --direct \ --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory \ --type bool \ --set /apps/nautilus/preferences/media_autorun_never true |
I've run these commands and my USB sticks are still automounting. Are these settings intended to take place immediately or do I need to log out/in? I have too much stuff up and running right now to logout, but I'll hopefully be able to do that soonish...
|
I tested with a DVD/CDROM without logging out/in or rebooting, and they are not automounting. Unfortunately, in the enviroment I am in, I cannot test with a usb stick, plus I have the usb-storage module disabled. It should however work.
ETA: I also have autofs off. #chkconfig autofs off Another option would be to add noauto to /etc/fstab for the devices being automounted... |
Sir/Ma'am,
Have you considered throwing a line in /etc/fstab? Code:
/dev/sdc /mnt/sdc ext4 noauto,ro,nouser,noexec 1 2 Hope it helps. alpo |
I finally rebooted my PC and it appears the gconftool commands suggested by JollyRogers did the trick. My USB sticks no longer automount when I insert them. Not exactly an intuitive operation, or at least not well documented, but at least there is a way.
I will mark this thread as SOLVED. Thanks for all the responses. Peter |
All times are GMT -5. The time now is 07:55 PM. |