我在 /etc/udev/rules.d/ 中有以下规则文件
KERNEL!="sd[a-z]*", GOTO="media_by_label_auto_mount_end"
# Import FS infos
IMPORT{program}="/sbin/blkid -o udev -p %N"
# Get a label if present, otherwise specify one
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"
# Global mount options
ACTION=="add", ENV{mount_options}="relatime"
# Filesystem-specific mount options
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"
# Mount the device
ACTION=="add", RUN+="/bin/mkdir -p /media/dir", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/dir"
# Clean up after removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/dir", RUN+="/bin/rmdir /media/dir"
# Exit
LABEL="media_by_label_auto_mount_end"
问题是每次我插入 USB 时都会出现这样的消息:USB 已安装(/dev/sdb 已安装在 /media/dir 中),卸载时用户无权卸载 USB。而且普通用户对 USB 没有写权限。
我可以做哪些改变来解决这些问题?
谢谢。