一、安装samba服务
[root@swarm-manager ~]# yum install samba samba-client
二、配置文件修改
[root@xunce-test-shipei-script ~]# cp /etc/samba/smb.conf /etc/samba/smb.confbak
[root@xunce-test-shipei-script ~]# vi /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
server string = Ted Samba Server %v
netbios name = TedSamba
security = user
map to guest = Bad User
passdb backend = tdbsam
[WebDev]
comment = project development directory
path = /data/log_files
valid users = ted
force group = co3
write list = ted
printable = no
create mask = 0644
directory mask = 0755
三、创建用户
[root@xunce-test-shipei-script ~]# groupadd co3
[root@xunce-test-shipei-script ~]# useradd ted -g co3 -s /sbin/nologin
[root@xunce-test-shipei-script ~]# smbpasswd -a ted //samba密码根据实际情况设置复杂度
New SMB password:
Retype new SMB password:
Added user ted.
四、创建共享目录
[root@TEST-2 samba]# mkdir -p /data/log_files
[root@TEST-2 samba]# chown ted:co3 /data/log_files
#注意设置属性,不然访问不了
五、启动samba服务,设置开机启动
[root@TEST-2 samba]# systemctl restart smb nmb
[root@TEST-2 samba]# systemctl enable smb nmb
六、开放端口
[root@TEST-2 samba]# firewall-cmd --permanent --add-port=139/tcp
success
[root@TEST-2 samba]# firewall-cmd --permanent --add-port=445/tcp
success
[root@centos9 packages]# firewall-cmd --reload
七、windows测试
执行同步
\172.16.0.21
在windows我的电脑中添加一个网络驱动器
留言