Linux???????USB?豸??udev+Samba
???????????? ???????[ 2015/7/21 11:26:05 ] ??????????????
???????????
???????????????USB?豸????Ubuntu?????????????????????Windows???????????\192.168.1.10?????????????????????д??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????в???USB?豸???????????????????????????????????
?????????????????????Ubuntu14.04??????????ù???????????????????磺???????????5??USB?豸??USB1~5???γ????豸????????????????????FAT32/NTFS/exFAT??????????2????????????????????????????????...
???????????
????1??????USB?豸??????????udev????
????2??????????SMBЭ?鹲????????????????ж??????Samba????????
???????????
??????? udev ??Ч?????????? Linux ?豸???
??????udev???????usb?豸
????CentOS 6.3??Samba????????????????
????????????
?????????Ubuntu 14.04??Samba?????????????????????????SELinux????????δ?????????????а??????????á???
????1?????exFat???????exFAT??????????
????root@Ubuntu1:~# sudo apt-get install exfat-utils
????2??????udev???????USB?豸???????
root@Ubuntu1:~# cd /etc/udev/rules.d/ #udev??????
root@Ubuntu1:/etc/udev/rules.d# vim 70-persistent-net.rules #?????????
KERNEL!="sdb?"?? GOTO="automount_exit"
ACTION=="add"?? SUBSYSTEM=="block"?? RUN+="/bin/mkdir /media/usb1"?? RUN+="/bin/mount -o uid=1000??user??codepage=936??utf8 $root/%k /media/usb1"
ACTION=="remove"?? SUBSYSTEM=="block"?? RUN+="/bin/umount /media/usb1"?? RUN+="/bin/rmdir /media/usb1"
LABEL="automount_exit"
#?????sdb???豸????д?????????????豸?????ж????????
KERNEL!="sdc?"?? GOTO="automount_exit"
ACTION=="add"?? SUBSYSTEM=="block"?? RUN+="/bin/mkdir /media/usb2"?? RUN+="/bin/mount -o uid=1000??user??codepage=936??utf8 $root/%k /media/usb2"
ACTION=="remove"?? SUBSYSTEM=="block"?? RUN+="/bin/umount /media/usb2"?? RUN+="/bin/rmdir /media/usb2"
LABEL="automount_exit"
KERNEL!="sdd?"?? GOTO="automount_exit"
ACTION=="add"?? SUBSYSTEM=="block"?? RUN+="/bin/mkdir /media/usb3"?? RUN+="/bin/mount -o uid=1000??user??codepage=936??utf8 $root/%k /media/usb3"
ACTION=="remove"?? SUBSYSTEM=="block"?? RUN+="/bin/umount /media/usb3"?? RUN+="/bin/rmdir /media/usb3"
LABEL="automount_exit"
KERNEL!="sde?"?? GOTO="automount_exit"
ACTION=="add"?? SUBSYSTEM=="block"?? RUN+="/bin/mkdir /media/usb4"?? RUN+="/bin/mount -o uid=1000??user??codepage=936??utf8 $root/%k /media/usb4"
ACTION=="remove"?? SUBSYSTEM=="block"?? RUN+="/bin/umount /media/usb4"?? RUN+="/bin/rmdir /media/usb4"
LABEL="automount_exit"
KERNEL!="sdf?"?? GOTO="automount_exit"
ACTION=="add"?? SUBSYSTEM=="block"?? RUN+="/bin/mkdir /media/usb5"?? RUN+="/bin/mount -o uid=1000??user??codepage=936??utf8 $root/%k /media/usb5"
ACTION=="remove"?? SUBSYSTEM=="block"?? RUN+="/bin/umount /media/usb5"?? RUN+="/bin/rmdir /media/usb5"
LABEL="automount_exit"
root@Ubuntu1:/etc/udev/rules.d# shutdown -r now #??????
????3?????Samba???????????
????root@Ubuntu1:~# apt-get install samba samba-common
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11