1. 安装samba
# dnf install -y samba samba-client samba-common
2. 配置samba
samba配置文件:/etc/samba/smb.conf
加入如下内容
[global]
map to guest = bad user
guest account = <你的用户名>
[mysamba] # 这里随便起个名字,作为共享目录的名字
path = <要共享的路径>
browseable = yes
writable = no
guest ok = yes
3. 启动samba
启动
# systemctl start smb
重启
# systemctl restart smb
开机启动
# systemctl enable smb
取消开机自启
# systemctl disable smb
4. 设置防火墙
# firewall-cmd --zone=public --add-port=139/tcp --permanent
# firewall-cmd --zone=public --add-port=445/tcp --permanent
# firewall-cmd --reload
5. 关闭SELINUX
RedHat系设置samba匿名访问需要关闭SELINUX
编辑/etc/selinux/config
把
SELINUX=enforcing
改为
SELINUX=disabled
5. 重启
# reboot
评论区