Preventing USB flash drive auto mounting

I have a Colibri VF50 running Linux 2.5.
I have an application that needs to mount a flash drive, access it and then unmount it. However, when a USB flash drive is plugged in, it mounts automatically. Is there a way to prevent this ?

There are actually two mechanisms in the standard Toradex Linux image capable of automounting: udisks & a udev automount rule.

Disable the automount rule by removing (or moving) it:

rm /etc/udev/rules.d/automount.rules

Disable udisks automounting of USB drives by creating a new udev rule (e.g. /etc/udev/rules.d/12-prevent-automount.rules):

ACTION=="add|change", SUBSYSTEM=="block", KERNEL=="sd*", ENV{UDISKS_PRESENTATION_HIDE}="1"

Is there any way to prevent the USB flash drive auto mounting feature in /run/media/root?

I am working with an Apalis IMX6 and, although I have deleted the automount.rules file and created the file 12-prevention-automount.rules, the flash drive is automatically mounted in /run/media/root folder.

The problem arises when I mount the drive in a different place and try to change the permissions of that folder to let other user work with it; I can not change them until I have unmounted the drive from /run/media/root first

Is there a way to prevent this?

HI Vabarca

Could you ask a new question with all the information about your target hardware and software? Which carrier board are you using?

Thanks and best regards, Jaski