Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
15
rated 0 times [  15] [ 0]  / answers: 1 / hits: 17004  / 2 Years ago, fri, march 25, 2022, 1:01:36

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?


More From » mount

 Answers
6

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 unmount.sh in /lib/udev with sudo -H gedit /lib/udev/unmount.sh and put next lines inside:



#!/bin/bash

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


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



chmod +x /lib/udev/unmount.sh


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/unmount.sh"


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.


[#31001] Saturday, March 26, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
giccolla

Total Points: 161
Total Questions: 124
Total Answers: 117

Location: Aland Islands
Member since Wed, Nov 17, 2021
3 Years ago
;