没有USB接口的路由器不是好路由器,有了USB接口OpenWrt才有更多的玩法,比如挂载U盘、移动硬盘等USB储存设备实现Samba共享,打造小型家庭服务器。
1、安装与USB相关的软件包:
opkg updateopkg install kmod-usb-core kmod-usb-ohci kmod-usb-uhci kmod-usb2 kmod-ledtrig-usbdev usbutilsopkg install kmod-usb-storage kmod-usb-storage-extras block-mountopkg install kmod-fs-ext4opkg install kmod-fs-ntfs ntfs-3gopkg install kmod-fs-vfatopkg install kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-utf8reboot
2、编辑配置文件自动挂载USB储存设备:
vi /etc/config/fstab
添加需要挂载的设备:
config mount option enabled '1' option target '/mnt/sda1' option device '/dev/sda1' option fstype 'ext4'
3、设为开机启动:
/etc/init.d/fstab enable/etc/init.d/fstab start
4、安装Samba:
opkg updateopkg install samba36-server luci-app-samba
5、配置Samba:
vi /etc/samba/smb.conf.template
注释掉这一行
invalid users = root
6、设为开机启动并设置访问密码:
/etc/init.d/samba enable/etc/init.d/samba startsmbpasswd -a root
7、配置需要Samba共享的目录:
vi /etc/config/sambaconfig sambashare option name 'Shares' option path '/mnt/sda1/' option read_only 'no' option guest_ok 'no'
from: http://demon.tw/hardware/openwrt-usb-storage-samba.html