How to Stop Ubuntu Linux from Automatically Opening the File Manager on USB Insertion

The Sudden Interruption

Ubuntu Linux is designed to be highly user-friendly. Whenever you plug a USB thumb drive, an external hard drive, or even a smartphone into your computer, the operating system detects the new storage device, mounts it, and instantly throws a new Nautilus (Files) window right in the middle of your screen. While this is helpful for average users, it is incredibly annoying if you are simply plugging in your phone to charge the battery while you are in the middle of writing code or watching a video.

How to Disable the Automatic File Manager Launch

You can turn off this aggressive auto-opening behavior using the built-in system settings, allowing Ubuntu to quietly mount the drive in the background without stealing your screen focus.

1. Open the main Ubuntu Settings application.

2. In the left-hand sidebar, scroll down and click on Removable Media (depending on your exact Ubuntu version, this might also be located under the “Default Applications” or “Details” menu).

3. Look for the setting labelled Never prompt or start programs on media insertion.

4. Tick the checkbox next to this option.

5. Alternatively, if you do not want to disable the feature entirely but just want to change the behavior for USB storage, find the dropdown menu labelled “Other Media” or “Software,” and change the default action from “Open Folder” to Ask what to do or Do nothing.

Mounting Drives Manually via Terminal

If you prefer complete, absolute control over your system and do not even want Ubuntu to auto-mount the drive in the background, you can disable the auto-mounting feature entirely via the dconf editor or terminal. Open your terminal and run gsettings set org.gnome.desktop.media-handling automount false. From now on, when you plug in a USB drive, Ubuntu will do absolutely nothing. The drive will receive power, but to access the data, you must manually run sudo mount /dev/sdb1 /mnt/usb, giving you total command-line authority over your hardware.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.