I run a number of Xubuntu 18.04 machines, and set up more from time to time. I want to be able to turn off automounting of USB sticks with commands, so that it becomes an automatic part of my setup.

I've seen the questions asked about 16.04, but the accepted answers mostly seem to be about GUI programs. Some attempts were made to use the gsettings command, but it required environment variables that are not automatically set up, and the procedures given to set them up were also GUI commands. At least in the questions I looked at.

I need a way to do this entirely on the command line.

  • Note: I tried 'gsettings set org.gnome.desktop.media-handling automount false' but it has no effect, probably because Xubuntu is not really using the gnome desktop -- but for some reason has its settings. I looked through the available settings and nothing else seemed relevant.
    – 4dummies
    Jan 20, 2019 at 23:07

4 Answers 4


Automount under xfce is managed by thunar-volman.

You can use the tool xfconf-query to list / read / write properties for thunar-volman.

# list properties for thunar-volman
$ xfconf-query -c thunar-volman -l                                  

You might want to

xfconf-query -c thunar-volman -p /automount-drives/enabled -s false # disable drive automount
xfconf-query -c thunar-volman -p /automount-media/enabled -s false # disable media automount
xfconf-query -c thunar-volman -p /autobrowse/enabled -s false # disable thunar popping up

I'm going to add my answer, although this is an old question, it's the first one that pops up when searching xubuntu disable automount.

It turns out it is easier than i thought, you just need to go to Settings Manager, then click on Removable Drives and Media, and disable Mount removable drives when hot-plugged and Mount removable media when inserted. And that's it

More info here https://docs.xfce.org/xfce/thunar/using-removable-media


You can deny automounting for certain drives by editing /etc/fstab.

First, you'll need to know the uuid of the device. Run sudo blkid to list all devices currently connected. Using the uuid you found there you can add a line like this to /etc/fstab to disable automounting for that device:

/dev/disk/by-uuid/<your_device_uuid> /media/mountpoint auto noauto,rw,user, 0 0  

The important option is noauto here. It disables the drive to be mounted automatically by the system, but you can still mount it if you call it explicitly with mount.

You can find more info about fstab in the Ubuntu documentation: https://help.ubuntu.com/community/Fstab

  • That's not what I need. I need to disable all automounting, for any USB whatever. I gather from questions about earlier versions that this is (or used to be) possible, but the methods have changed. See for instance (askubuntu.com/questions/89244)
    – 4dummies
    Jan 20, 2019 at 21:04

I may have found the answer, but it's a bit unusual so I'm not sure if there are bad side-effects.

The activity I want to suppress is the automounting of USB drives to the /media directory. So I tried just rmdir-ing that directory, and it seems to work.

Now when I insert a USB that is not in /etc/fstab, nothing much happens except that it is recognized by blkid and by lsblk, and I can mount it manually if I choose. Or not. PERFECT!

I don't see any error reports in /var/log/syslog or any other file in /var/log, so I'm hopeful.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .