Ubuntu – Set default mount options for usb

mountUbuntuusb-drive

Specifically, I'm looking for a way to change the 'noexec' flag, which seems to be the current default, to 'exec' for any USB device when it is first mounted. At the moment, I have to do this manually using the command 'mount -o remount,exec /media/removable/nameofusb' every time I boot the system.

Whilst I could add this to the list of autostart applications (this USB is rarely removed from my Chromebook), I would like to change the default options for any device so that files on them can be executed without manually changing this.

I am running Ubuntu 14.04 (xfce) on an Acer Chromebook 14 using crouton.

Best Answer

any USB device when it is first mounted

this USB is rarely removed from my Chromebook

ok so in theory it might be feasible to disable the auto-mounting, which is performed by your graphical desktop environment (XFCE). then you can configure your own automounter in such a way to use the options you desire

What would be much simpler is to create an /etc/fstab entry for your specific USB device.

Editing /etc/fstab could potentially cause your system boot to fail. GNOME Disks provides a GUI for it though. Select the device in the left pane, select the filesystem ("Volume") in the main pane, click on the cog button below, and select "edit mount options". The box for mount options sadly appears to be the unlabeled one, but the default contents will hopefully look familiar. E.g. "nosuid,nodev,nofail,x-gvfs-show".

The Ubuntu package to install for GNOME Disks is called gnome-disk-utility. You can run it using the gnome-disks command.

GNOME Disks does not have an XFCE equivalent, it can be used for a number of tasks, so if it doesn't require too many other packages then you might well want to keep it installed.

Related Question