[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to disable USB automounts



On Mon 05 Sep 2011 at 09:17:22 +0300, Itay wrote:

> When I stick a USB device into the socket it is automounted; KDE pops up 
> device notification widget, file manager window, etc.
>
> I tried to disable it:
> KDE -> System Settings -> Removable Devices, and unchecked
> "Enable automatic mounting of removable devices".
> This didn't have any effect.
>
> In fact, I would like to disable automounts for all users.

In which case it would have to be done at the system level. Even if the
KDE System Settings method worked for you it is (if it's anything like
XFCE) configurable by a user - not what you want.

> I found in this thread two (contradicting? redundant?) advices.
> http://www.linuxquestions.org/questions/linux-newbie-8/disabling-usb-automount-kde-891757/
>
> 1) To remove the user from plugdev group.
>    (But how to avoid future new users from being added to that group?)

The user would no longer be able to mount, view or use files on the USB
device. Which is ok if that is your intention. Removing a new user from
the plugdev group is a snap with vigr and not tedious if it is only
done every so often (and you remember!).

> 2) To disable automount in udev rules.
>    I don't understand udev at all, and couldn't locate the actual
>    lines that I should comment out.

Create the file

   /etc/udev/rules.d/10-no-automount.rules

and in it put the line

   ACTION="add|change", subsystem=="block", ENV{UDISKS_AUTOMOUNT_HINT}="never"

No need to reboot as it takes effect immediately.

Before doing this you will have read udisks(7) and know why it may not
work. You may also want to investigate changing the udev rule to see the
effect of UDISKS_PRESENTATION_HIDE.


Reply to: