If you are using udev, you can do it with a udev rule. Specifically, check for the device ID when it is plugged in, and if it is THIS device (and no other) mount it HERE. You can force the exact mount you want with a script that is invoked from the udev rule.
To give an example, I have a USB pen drive that is not properly detected by udev. So I wrote this rule to identify it:
Code:
SUBSYSTEMS=="usb", SYSFS{product}=="USB Flash Memory", KERNEL=="sd?1", NAME="%k", MODE="0666", SYMLINK+="flashmem%n", RUN+="/etc/udev/scripts/penmount.sh flashmem%n pendrive%n"
The rule specifically looks for a usb device that identifies itself as "USB Flash Memory" which is how my PNY Technologies pen drive identifies itself. When the device is identified, a script named penmount.sh is invoked:
Code:
#!bin/bash
if [ "$ACTION" == "add" ]; then
mkdir /media/"$2"
mount -t vfat -o rw,user,auto,sync,noatime,umask=0 /dev/"$1" /media/"$2"
chmod 777 /media/"$2"
else
umount /media/"$2"
rmdir /media/"$2"
fi
This script actually mounts the drive.