In Xubuntu 14.04 I have tried to disable USB automount by creating the following two files as found here: Prevent a specific USB device from auto-mounting and rebooting:


udisks --unmount /dev/sdn1
udisks --detach /dev/sdn


ACTION=="add", ATTRS{idVendor}=="xxxx", ATTRS{idProduct}=="yyyy", RUN+="/lib/udev/unmount.sh"

That didn't work, so I created another file as found here https://unix.stackexchange.com/questions/85061/automount-not-disabling-in-ubuntu-12-04-or-13-04



After rebooting the USB still automounted.

I then installed gnome-disk-utility, which installed but no launch icon was created and typing 'gnome-disk-utility' is not recognized- I can't figure out how to launch it.I note gnome-system-tools is installed - but again I can't work out how to start it.

  • Try: Menu - Settings - Drivers and ... - Storage and untick: mount ... mount ... explore ... – kyodake Jul 26 '15 at 14:56
  • Menu - Settings doesn't have anything called "Drivers and..." or "Storage" – Michael Nov 9 '16 at 20:21

For udisks2:

If udisks2 is in use, following actions are needed to not automount a device. Fisrt, you need to get informations about the device to write a udev rule. Unmount the device, become root via

sudo su

then run this command:

udevadm monitor --environment --udev

After that, plug the device to the computer. Now, you can see relative informations about the device. What you need is ENV{ID_VENDOR} and ENV{ID_FS_UUID}. Especially ID_FS_UUID is important because it is a unique value for the device. Press ctrl+c to exit udevadm.

Then, run the following command to get other informations you need

udevadm info -a -p $(udevadm info -q path -n /dev/sdX)

Replace /dev/sdX with your drive. Look for ATTRS{idVendor} and ATTRS{idProduct} values. You need SUBSYSTEM AND DRIVER values to specify which device block this rule will be applied and ENV{UDISKS_AUTO}="0" to make the device not auto-mountable. If you get all informations you need, it is time to write udev rule. Open a new rule file:

sudo -H gedit /etc/udev/rules.d/10-noautomount.rules

And write information you got to it:


Save the file and close it. A rule in /etc/dev/rules.d/ directory has the highest priority. By writing the rule in that directory, we will prevent any problem that may hinder the rule.

Now, you can test your rule to see whether it is working or not. First, you need to learn "devpath" of the device. You will see lines in the output of

udevadm info -a -p $(udevadm info -q path -n /dev/sdX)

command similar to this line:

looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5...'

Some of them is very long and is not usefull for you. You need to cut that line to a degree which is usefull for you. To learn where to cut, run this command:

dmesg | grep usb

You will see lines relative to the device similar to these lines:

usb 2-1.5: new high-speed USB device number 15 using ehci-pci
usb 2-1.5: New USB device found, idVendor=3538, idProduct=0070
usb 2-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-1.5: Product: PQI USB Flash drive
usb 2-1.5: Manufacturer: PQI
usb 2-1.5: SerialNumber: XQVBW9KR
usb-storage 2-1.5:1.0: USB Mass Storage device detected

Pay attantion to value after usb one (2-1.5). It shows that your device's path and where to cut. So "devpath" of this device is


Now you can test the new udev rule by running this command:

udevadm test /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5

Near the end of the output of above command, if you see the line


it means that your new rule is working. To apply the new rule, you need to reload udev rules by

udevadm control --reload

If it does not work, run

udevadm trigger

After that, you can see wherher the new rule is working or not by un-plugging the device and re-plugging it. Your device will be shown in Unity launcher like this:

enter image description here

In my case, "nd" is the device to which no-automount udev rule is applied. If I press the icon of the device, it will be mounted.

For udisks

If udisks is in use, you can use ENV{UDISKS_PRESENTATION_NOPOLICY}="0" value to make the device not-automountable. Since my system ( Ubuntu 15.04) isn't using udisks, I can not give specific instructions but the process is similar. Write a new udev rule in /etc/udev/rules.d/ directory for your device with values you get above and add ENV{UDISKS_PRESENTATION_NOPOLICY}="0" value instead of ENV{UDISKS_AUTO}="0" value.

I hope this answer help you.

  • Just a note, for the test udevadm test /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5 I got an error that the dive couldn't be fount, checked the direcories and found I needed to append a ':1.0' on the end, then it worked. Although the device doesnt mount - it still shows as an icon when I plug it in, and Xubuntu still seems to have control over it as when I try to access from a clonezilla boot, clonezilla can't see it (could also be somethiong related to the VM). – Don Smythe Jul 26 '15 at 21:55
  • wow this is really complex. i just don't want anything automounted ever, regardless of vendor or device, and i need to be able to flip it on and off like a switch – Michael Nov 9 '16 at 20:21
  • 1
    @Michael For XUbuntu try Settings->Removable Drives and Media then uncheck the boxes under removable storage – Don Smythe Nov 10 '16 at 7:56

copied from https://unix.stackexchange.com/a/536545/302588:

# /etc/udev/rules.d/99-noautomount.rules

https://www.systutorials.com/docs/linux/man/7-udisks/ :

  If set to 1 this is a hint to presentation level software that the device should not be shown to the user.

  If set to 1 this is a hint to presentation level software that the device should not be automounted or autoassembled (for e.g. components of a multi-disk device).

  A variable to influence whether a device should be automounted. Possible values include "always" (to hint that a device should always be automounted) and "never" (to hint that a device should never be automounted). Note that this is only a hint - the auto-mounter might not honor it.

  If set, this will override the usual bus type based detection of whether a device is considered "system internal". "0" means "removable" (i. e. eligible for automounting, and normal users can mount), any other value means "system internal" (i. e. no automounting, and only administrators can mount).

https://www.systutorials.com/docs/linux/man/8-udisks/ :

  If set, this overrides the value of the HintIgnore property.

  If set, this overrides the value of the HintAuto property.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.