I want to stop a USB device from automounting in Ubuntu 13.04. For example, when I connect my iPhone 5 to my desktop I am consistently prompted for what I want to do (whether or not I want to erase the "iPod" connected to my machine, etc). Since I don't use the computer as anything more than a way to charge the device, is there a way to prevent the device from mounting and still allow the device to draw current from the machine?
Ubuntu – Prevent a specific USB device from auto-mounting
automountmountudevudisksunmount
Best Answer
Using the terminal and gedit
First find the ID for your device from a terminal using
lsusb
when your device is connected (eg0951:1692
). Also you should to find what is the name of your device withlsblk
. Let say the name is/dev/sdb1
.Create a new script, let say
unmount.sh
in/lib/udev
withsudo -H gedit /lib/udev/unmount.sh
and put next lines inside:Save the file, close it and make it executable with:
Now, you must to make a new rule file in
/etc/udev/rules.d/
withsudo -H gedit /etc/udev/rules.d/100-unmount-iphone.rules
and put a new rule in there like this:To reload udev rules without restart, use next command:
Using Cuttlefish
Or, another way is to install and use Cuttlefish - a simple tool that realises reflexes on your computer.