I have a question regarding the auto-mounting of my Nikon camera. When the camera is connected via USB the memory card of the camera is mounted and displays as a drive on the task bar. This causes conflict with tethering programs that need to take control of the camera. I can disable auto-mounting altogether using dconf, but it is a pain to keep turning it on and off all the time. How can just disable the behaviour for this camera alone and nothing else? Thanks in advance :)


Let's say your device is /dev/sdb1. Using lsusb get the ID of your device (it will be something like 0651:1722 or whatever)

Create a script called script.sh in /lib/udev (you may have to use sudo while creating the file) and put the following lines in it:


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

Save it and make it executable with:

chmod +x /lib/udev/script.sh

Make a udev rule file called 100-unmount-SDcard.rules in /etc/udev/rules.d/ (again you should use sudo to create this file) and populate it with:

ACTION=="add", ATTRS{idVendor}=="<your-id>", ATTRS{idProduct}=="<your-id>", RUN+="/lib/udev/script.sh"

Save the file and run:

sudo udevadm control --reload-rules

For more options see Prevent a specific USB device from auto-mounting

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.