服务器:
yum -y install samba*
firewall-cmd --per --add-port=137/tcp
firewall-cmd --per --add-port=138/tcp
firewall-cmd --per --add-port=139/tcp
firewall-cmd --per --add-port=445/tcp
firewall-cmd --rel
vim /etc/samba/smb.conf
[hrr]
path = /hrr
browseable = yes
write list = hrr
useradd hr
useradd hrr
pdbedit -a -u hr
密码:redhat
pdbedit -a -u hrr
密码:redhat
mkdir /hrr
chmod 777 /hrr
chcon -R -t samba_share_t /hrr
systemctl enable smb nmb
systemctl start smb nmb
客户机:
yum -y install samba*
yum -y install cifs*
mkdir /mnt/hrr
vim /etc/smbuser
username=hrr
password=redhat
vim /etc/fstab
//server0/hrr /mnt/hrr cifs defaults,multiuser,credentials=/etc/smbuser,sec=ntlmssp 0 0
mount -a
cd /mnt/hrr
ls #成功
touch abc #不成功
cifscreds add server0 -u hrr
touch abc #成功
时间: 2024-12-13 01:17:57