安装samba软件包:

[root@w ~]# yum install samba -y

创建系统用户:

[root@w ~]# useradd www

配置samba共享文件smb.conf:

[root@w ~]# vim /etc/samba/smb.conf
#最后一行添加
[www]
comment = shared
path = /home/www
writeable = yes
public = yes

添加samba账户设置密码:

[root@w ~]# smbpasswd -a www
New SMB password:
Retype new SMB password:
Added user www.
[root@w ~]#

关闭防火墙及网络状态:

[root@w ~]# systemctl stop firewalld
[root@w ~]# setenforce 0
[root@w ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are
protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@w ~]#

重启samba服务:

[root@w ~]# systemctl restart smb

主机win+R输入服务地址进行连接:

Linux 中 Samba 部署_ci

输入刚才设置的账号密码进行查看www账号的共享目录:

Linux 中 Samba 部署_重启_02