Fedora-29-install-samba-安装配置samba-smb

#安装samba
dnf install samba samba-client -y

#添加用户
useradd test001
#添加smb用户密码
smbpasswd -a test001

#防火墙开启端口
firewall-cmd --add-service=samba
firewall-cmd --add-service=samba --permanent

#启动服务,设置默认自动启动
systemctl start smb
systemctl enable smb

#添加匿名用户
vim /etc/samba/smb.conf
[global]
        ...
        ...
        map to guest = bad user
        guest account = nobody

[public]
        comment = Public Stuff
        path = /home/public
        public = yes
        writable = yes
        browseable = Yes
        printable = no
        create mask = 0755
        guest ok = yes
        read only = No
#       write list = +staff
        security = share

chmod 755 /home/public

#设置selinux,可自行设置相应的权限 selinux

setsebool -P samba_export_all_rw 1
setsebool -P samba_export_all_ro 1
setsebool -P use_samba_home_dirs 1


####################
[root@localhost ~]# getsebool -a | grep smb
smbd_anon_write --> off
[root@localhost ~]# getsebool -a | grep samba
samba_create_home_dirs --> off
samba_domain_controller --> off
samba_enable_home_dirs --> on
samba_export_all_ro --> on
samba_export_all_rw --> on
samba_load_libgfapi --> off
samba_portmapper --> off
samba_run_unconfined --> off
samba_share_fusefs --> off
samba_share_nfs --> off
sanlock_use_samba --> off
tmpreaper_use_samba --> off
use_samba_home_dirs --> on
virt_use_samba --> off
#####################



#客户端登录测试
smbclient -L 127.0.0.1 -U test001%