openwrt samba网络硬盘
环境
CHAOS CALMER (15.05.1, r48532)
参考
OpenWrt 15.05 下安装Samba
OpenWrt下Samba共享设置和Win7共享
Openwrt安装并配置Samba共享服务
应用环境
windows直接读取路由器存储的文件,不必下载下来,相当于电脑的网络硬盘
操作
安装
opkg update #更新
opkg install samba36-server luci-app-samba #安装samba和luci管理界面
配置
修改/etc/samba/smb.conf.template
或者LuCI-->服务-->Network Shares-->Edit template直接修改
vi /etc/samba/smb.conf.template
注释[global]下的invalidusers = root
,允许root用户登陆
增加共享目录
[etc] #etc为连接samba后,客户端显示的名称,自定义
path = /etc #/etc服务器端共享目录,可自定义为其他目录
valid users = root #允许root
guest ok = no #匿名用户否
[可选]添加
read only = yes
只读
设置密码
smbpasswd -a root
启动
/etc/init.d/samba restart
开机启动
默认是开机自启的,可以在 Luci -->系统-->启动项-->中禁止
客户端访问
windows端访问,资源管理器里输入
\\192.168.1.1
进入选择目录点击输入账号密码
其他终端添加samba即可
注
对于Linux的samba漏洞,不推荐对公网开放samba服务,而是使用vpn连上路由器后使用samba
我最终的配置文件
[global]
netbios name = |NAME|
display charset = |CHARSET|
interfaces = |INTERFACES|
server string = |DESCRIPTION|
unix charset = |CHARSET|
workgroup = |WORKGROUP|
browseable = yes
deadtime = 30
domain master = yes
encrypt passwords = true
enable core files = no
guest account = nobody
guest ok = yes
# invalid users = root
local master = yes
load printers = no
map to guest = Bad User
max protocol = SMB2
min receivefile size = 16384
null passwords = yes
obey pam restrictions = yes
os level = 20
passdb backend = smbpasswd
preferred master = yes
printable = no
security = user
smb encrypt = disabled
smb passwd file = /etc/samba/smbpasswd
socket options = TCP_NODELAY IPTOS_LOWDELAY
syslog = 2
use sendfile = yes
writeable = yes
[Download]
path = /usb/disk1t3/download/
valid users = root
guest ok = no
read only = yes