CentOS 7安装配置samba服务器

1、关闭防火墙

注:centos7是自带的firewall,centos6是iptables

# systemctl disable firewalld.service

2、关闭SELINUX

# sestatus //查看selinux状态

# setenforce //临时关闭SeLinux

永久关闭SeLinux,需要修改配置文件/etc/selinux/config,将SELINUX置为disabled,然后重启系统。

3、安装samba

# yum install samba samba-client samba-common -y

4、备份已有配置 # mv /etc/samba/smb.conf /etc/samba/smb.conf.bak

      添加新的配置
      # vim /etc/samba/smb.conf

输入以下内容:

[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ============================== 
[Public]
path = /home/smb/share
writable = yes
browsable = yes
guest ok = yes
guest only = yes
create mode = 0777
directory mode = 0777

注意:在samba4中 share 和 server已经被禁用,需要用 security = user 和map to guest =Bad User来实现无密码访问目录

5、为samba服务创建用户、属组以及修改权限

# groupadd smb

# useradd smb -d /home/smb/ -g smb -s /sbin/nologin

# chmod -R 777 /home/smb/share

# chown -R smb:smb /home/smb/share

# smbpasswd -a smb

6、启动服务

# systemctl enable smb.service
# systemctl enable nmb.service
# systemctl restart smb.service
# systemctl restart nmb.service

7、设置防火墙
# firewall-cmd --permanent --zone=public --add-service=samba
# firewall-cmd --reload

8、验证:WINDOWS输入 \\服务器IP 访问

为便于之后访问,可映射到网络驱动器,见上一篇文章

https://blog.csdn.net/zangyongcan/article/details/83831970

参考:

https://www.cnblogs.com/hnxxcxg/p/6841778.html

https://blog.csdn.net/zangyongcan/article/details/83831970

你可能感兴趣的:(工具开发,linux)