samba服务搭建

527 阅读1分钟

一、关闭防火墙

# 关闭防火墙
systemctl stop firewalld    
# 禁止防火墙开机自启动
systemctl disable firewalld 
# 查看防火墙状态
systemctl status firewalld  
setenforce 0

vim /etc/sysconfig/selinux
将未注释的SELINUX行的值改为disabled
SELINUX=disabled

二、安装samba与配置

1. 安装与启动
yum install -y samba

# 启动samba并设置开机自启动
systemctl enable smb
systemctl enable nmb
systemctl start  smb
systemctl start  nmb
2. 相关配置
  • 创建共享文件夹及测试文件
mkdir -p /smb/share
chmod 777 /smb/share

cd  /smb/share
echo 'Hello World' > 1.txt
  • vim /etc/samba/smb.conf

    • 在结尾处添加以下内容
[share]                       
        comment = share       
        path =/smb/share      
        browseable = yes      
        read only = no     
        writeable = yes       
        public = Yes         
  • 添加用户并启动服务 请记住设置的密码
# 添加用户并设置密码 
useradd user01
smbpasswd -a user01
# 重启服务
systemctl restart smb
systemctl restart nmb

# 查看服务是否启动
systemctl status smb
systemctl status nmb

三、window端访问测试

在物理机中使用 win+R 调出运行窗口,按照图片输入samba服务器ip地址后弹出登录界面,输入用户和密码即可


注 : 仅适用于初学者参考使用


相关文章: