个人备忘录
配置全局共享参数
配置文件路径为 /etc/samba/smb.conf.template
,将 [global]
中的 invalid users = root
注掉,像下面的样子:[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
设置/etc/config/samba 或者openwrt 后台中添加需要目录也可以
config sambashare
option 'name' 'tmp'
option 'path' '/tmp'
option 'workgroup' 'WORKGROUP'
option 'description' 'OpenWrt'
option 'homes' '1'
option 'read_only' 'no'
option 'guest_ok' 'yes'
option 'create_mask' '0750'
option 'dir_mask' '0750'
option 'users' 'root
设置完此配置后,samba服务启动后在 /etc/samba/smb.conf中会显示,其中,name是外面设备访问用的路径,path是本设备的真实路径
4. 启动服务
配置完成后,启动Samba服务即可。
/etc/init.d/samba start
设置开机启动:
/etc/init.d/samba enable
设置root用户密码:
Samba的共享用户密码是单独配置的,执行下面的命令将root添加为共享用户,同时按照命令提示设置共享密码
也设置设置其他的用户名
smbpasswd -a root
====================补充说明============
openwrt samba使用的端口号:
139
445