1 将10-usbkey.rules 复制到/etc/udev/rules.d/
KERNEL=="sd[b-z][0-9]", SUBSYSTEM=="block", RUN+="/etc/udev/usbmount.sh %k"
2 将usbmount.sh 复制到/etc/udev/目录中
#!/bin/bash
if [ $ACTION == "add" ];then
mkdir /media/ubuntu/$1
mount /dev/$1 /media/ubuntu/$1
else
umount -l /media/ubuntu/$1
rm /media/ubuntu/$1 -fr
fi