直接配置 smb.conf ( path = /etc/samba/smb.conf )。
首先,进入到 samba 文件夹:
cd /etc/samba/
备份 smb.conf:
mv smb.conf smb.conf.bak
新建并打开 smb.conf:
vi smb.conf
在 smb.conf 中加入以下代码:
[global] //全局配置
workgroup = LSS //显示在 windows 的工作组
netbios name = Test //显示在 LSS 工作组 下一级的计算机名
server string = LinuxSambaServer(LSS) // samba 服务器说明(自定义)
security = share //验证登录方式为 share
[linux01] //显示在 Test 计算机的下一级目录的共享文件夹名
path = /home/test/ // linux01 共享文件夹的路径、(以后新建)
writeable = yes //可写(别写成了 writable )
browseable = no //仅显示本用户可用的共享(直观)
guest ok = yes //匿名用户以guest身份登录,去掉后以 user 方式登录
新建共享目录( /home/test/ ):
mkdir -p /home/test/
给该共享目录赋权( /home/test/ ):
chmod -R 777 /home/test/
启动 smb 和 nmb :
smbd
nmbd
查看是否已启用(?) :
pgrep smbd
pgrep nmbd
在 windows 中打开共享文件夹 :
win + r
\\192.168.0.2 // Linux ip自己 ifconfig 查看
回车