Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am working on a project, and for this I need to disable the aumounting of hard-drives in Ubuntu both at startup and when I plug an hard-drive.

I tried one solution with "edit-conf" disabling automount at org.gnome.desktop.media-handling but when I plug a hardrive ubuntu still mounts it an open a window even when I restart the computer in between.

There is also the fstab solution but the thing is I don't know in advance the UUID of the drive I don't want to mount automatically.

From want I understand there is the solution of editing an udev rule, but i'm not a specialist of that.

share|improve this question

2 Answers 2

Run these two commands:
gsettings set org.gnome.desktop.media-handling automount 'false'
gsettings set org.gnome.desktop.media-handling automount-open 'false'

Or you can try it with a udev rule:
sudo nano /etc/udev/rules.d/85-no-automount.rule
Paste this line SUBSYSTEM=="usb", ENV{UDISKS_AUTO}="0" and save the file.
Reboot the system.

share|improve this answer
    
It didn't work, I executed the two command then reboote, and when i plugged my hard-drive, ubuntu stills mount it. –  Didier Chavaroche Jul 16 at 9:33
    
You can try the udev rule I added above. –  Pabi Jul 16 at 9:37
    
I didn't try the rule, but I have a question before, I plug the hard drives directly onto the SATA ports of my computer, How should I translate the rule? SUBSYSTEM=="sata"? –  Didier Chavaroche Jul 25 at 9:35

You can try to add the module to the blacklist:

sudo gedit /etc/modprobe.d/blacklist.conf

add:

blacklist usb-storage

or

echo "blacklist usb-storage" | sudo tee -a /etc/modprobe.d/blacklist.conf

Enabling it later should just be:

sudo modprobe usb-storage

share|improve this answer

Your Answer

 
discard

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.