服务端:
[root@linuxprobe ~]# yum install samba -y
[root@linuxprobe ~]# mv /etc/samba/smb.conf /etc/samba/smb.bak
[root@linuxprobe ~]# cat /etc/samba/smb.bak | grep -v "#" | grep -v ";" | grep -v "^$" > /etc/samba/smb.conf
[root@linuxprobe ~]# vim /etc/samba/smb.conf
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
security = user
passdb backend = tdbsam
[rick]
comment = ding
path = /rick
public = no
writable = yes
[root@linuxprobe ~]# systemctl restart smb
[root@linuxprobe ~]# systemctl enable smb
ln -s ‘/usr/lib/systemd/system/smb.service‘ ‘/etc/systemd/system/multi-user.target.wants/smb.service‘
[root@linuxprobe ~]# id linuxprobe
uid=1000(linuxprobe) gid=1000(linuxprobe) groups=1000(linuxprobe)
[root@linuxprobe ~]# pdbedit -a -u linuxprobe
new password:
retype new password:
Unix username: linuxprobe
[root@linuxprobe ~]# mkdir -p /rick
[root@linuxprobe ~]# chown -Rf linuxprobe:linuxprobe /rick
[root@linuxprobe ~]# chmod -Rf 777 /rick
[root@linuxprobe ~]# getsebool -a | grep samba
samba_create_home_dirs --> off
samba_domain_controller --> off
samba_enable_home_dirs --> off
samba_export_all_ro --> off
samba_export_all_rw --> off
samba_portmapper --> off
samba_run_unconfined --> off
samba_share_fusefs --> off
samba_share_nfs --> off
sanlock_use_samba --> off
use_samba_home_dirs --> off
virt_sandbox_use_samba --> off
virt_use_samba --> off
[root@linuxprobe ~]# setsebool -P samba_export_all_rw=on
[root@linuxprobe ~]# iptables -F
[root@linuxprobe ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
客户端:
[root@localhost ~]# yum install cifs-utils -y
[root@localhost ~]# vim auth.smb
username=linuxprobe
password=ding
domain=MYGROUP
[root@localhost ~]# vim /etc/fstab
[root@localhost ~]# mkdir /rick
[root@localhost ~]# vim /etc/fstab
//192.168.10.10/rick /rick cifs credentials=/root/auth.smb 0 0
[root@localhost ~]# mount -a
[root@localhost ~]# df -h
//192.168.10.10/rick 18G 3.0G 15G 17% /rick
原文:https://www.cnblogs.com/dinghailong128/p/12178414.html