OpenWrt挂载USB储存设备实现Samba共享

没有USB接口的路由器不是好路由器,有了USB接口OpenWrt才有更多的玩法,比如挂载U盘、移动硬盘等USB储存设备实现Samba共享,打造小型家庭服务器。

 

1、安装与USB相关的软件包:

opkg update

opkg install kmod-usb-core kmod-usb-ohci kmod-usb-uhci kmod-usb2 kmod-ledtrig-usbdev usbutils

opkg install kmod-usb-storage kmod-usb-storage-extras block-mount

opkg install kmod-fs-ext4

opkg install kmod-fs-ntfs ntfs-3g

opkg install kmod-fs-vfat

opkg install kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-utf8

reboot

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 update

opkg 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 start

smbpasswd -a root

7、配置需要Samba共享的目录:

vi /etc/config/samba

config 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

你可能感兴趣的:(samba)