Preventing USB automount

Stuart Sears stuart at sjsears.com
Tue Nov 4 17:55:01 UTC 2008


Steve Berg wrote:
> john wendel wrote:
>> Tom Horsley wrote:
>>> On Mon, 3 Nov 2008 15:18:55 -0600 (CST)
>>> "Steve Berg" <sberg at mississippi.com> wrote:
>>>
>>>> Is there an easy rule to create for udev that will turn off that
> function?
>> Or you could take the easy way out (like I do), "chkconfig haldaemon
> off". I don't miss it at all.
>> Regards,
>>
>> John
>>
> Yep, that does work, unfortunately it also breaks a few things I don't
> want to break
> 
> So far I've managed to tweak the rule in 50-udev-default.rules so I at
> least get an email notification that a usb device has been attached.  Now
> I need to do that and prevent the mounting of said device.

The issue here is that it's not udev that is doing the mounting, AFAIK.
This is done by hal - or it would happen on the console too.

do you want the device nodes created at all?
or just not mounted?

you can completely disable usb storage devices using /etc/modprobe.conf,
if you wish, just add this line to it:

install usb_storage /bin/true

This will prevent usb_storage devices from working (as long as
usb_storage is not already loaded). It's a bit of a drastic solution,
but it works fine. However, their device nodes will also not exist, so
manual mounting is out of the question as well.

> Maybe somebody can offer advice on this:  If I leave the libusb section in
> 50-udev-default.rules file and put my new rule that does notification in a
> 20-local.rules I understand that the 20 file is a higher priority.  But
> does that also mean that if a new device gets a hit in the 20 file that it
> will ignore the rule in 50?  Or should I be commenting out the libusb
> entry in 50 so it's disabled and only the 20-local.rules file will take
> action?

The hal solution offered earlier seems like a good start if you want the
devices to be mountable, but not automounted.

There's probably a gconf key to prevent this from happening under GNOME,
too if you'd rather. KDE will have a similar setting.


Stuart
-- 
Stuart Sears RHCA etc.
"It's today!" said Piglet.
"My favourite day," said Pooh.




More information about the fedora-list mailing list