安装samba
yum -y install samba samba-client
启动Samba应用
systemctl start smb nmb
1、局域网ping通,win系统和centos同一网段。
查看win系统计算机工作域(WORKGROUP)
net config workstation
2、新建共享文件夹及路径
mkdir -p /home/logger
3、修改文件夹权限
chmod -R 777 logger
4、创建系统用户
useradd -s /sbin/nologin logadmin
5、创建Samba用户
smbpasswd -a logadmin
6、修改所属主组
chown logadmin.logadmin logger
7、配置samba.conf文件
配置Samba服务
[root@Linuxidc-Server storage]# vi /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
server string = Samba Server Version %v
netbios name = Linuxidc-Server
log file = /var/log/samba/%m.log
max log size = 10240
security = user
passdb backend = tdbsam
[logger]
comment = Logs Directories
path = /storage/logger/
public = no
admin users = logadmin
valid users = @logadmin
browseable = yes
writable = yes
create mask = 0777
directory mask = 0777
force directory mode = 0777
force create mode = 0777
[shared]
# 共享文件目录描述
comment = Shared Directories
# 共享文件目录
path = /storage/shared/
# 是否允许guest访问
public = no
# 指定管理用户
admin users = admin
# 可访问的用户组、用户
valid users = @admin
# 是否浏览权限
browseable = yes
# 是否可写权限
writable = yes
# 文件权限设置
create mask = 0777
directory mask = 0777
force directory mode = 0777
force create mode = 0777
7、关闭防火墙(关闭或者添加允许)
smbd应用进程主要监听139和445端口, nmbd应用进程主要监听137与138端口。
查看端口命令
[root@Linuxidc-Server ~]# netstat -tunlp | grep -E 'smbd|nmbd'
CentOS 7.0默认使用的是firewall作为防火墙
查看防火墙状态
firewall-cmd --state
停止firewall
systemctl stop firewalld.service
禁止firewall开机启动
systemctl disable firewalld.service
8、关闭selinux (如果不关闭,文件放不进去)
临时关闭:
[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
永久关闭:
[root@localhost ~]# vim /etc/sysconfig/selinux
SELINUX=enforcing 改为 SELINUX=disabled
重启服务reboot
9、重启服务
service smb start
service nmb start
参考https://www.cnblogs.com/xiangsikai/p/9158745.html