Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 7 down vote accepted

Using the terminal and gedit

First find the ID for your device from a terminal using lsusb when your device is connected (eg 0951:1692). Also you should to find what is the name of your device with lsblk. Let say the name is /dev/sdb1.

Create a new script, let say in /lib/udev with sudo -H gedit /lib/udev/ and put next lines inside:


udisks --unmount /dev/sdb1
udisks --detach /dev/sdb

Save the file, close it and make it executable with:

chmod +x /lib/udev/

Now, you must to make a new rule file in /etc/udev/rules.d/ with sudo -H gedit /etc/udev/rules.d/100-unmount-iphone.rulesand put a new rule in there like this:

ACTION=="add", ATTRS{idVendor}=="0951", ATTRS{idProduct}=="1692", RUN+="/lib/udev/"

enter image description here enter image description here enter image description here

To reload udev rules without restart, use next command:

sudo udevadm control --reload-rules

Using Cuttlefish

Or, another way is to install and use Cuttlefish Install comixcursors-lefthanded - a simple tool that realises reflexes on your computer.

share|improve this answer
Oh well, looks like Cuttlefish is no longer available – Antony Sep 25 '14 at 2:29
I have installed Cuttlefisth just now on Ubuntu 14.04 – Anwar Shah Jan 31 '15 at 15:05
used udisksctl in to unmount a Windows partition from a USB flash drive: udisksctl unmount --block-device /dev/sr1. for reference: – syslogic Nov 9 '15 at 3:17

To control which programs automatically start when you plug in a device, go to

System-Settings - Details - Removable Media

enter image description here

Source: Ubuntu Documentation - Mount/USB

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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