1: first, determine if SELinux is the problem:
1.1 display the current user's SELinux contex
# ID-z
1.2 view SELinux status
# Sestatus-BV
1.3: We can temporarily disable SELinux to use the Samba server:
# Setenforce 0
(# Setenforce 1 --- enable SELinux)
2. Set Samba (this step is simpler on the image interface)
Edit the/etc/samba/smb. conf file!
Add at the bottom:
[Gongxiang]
Path =/gongxiang
Writeable = Yes
; Browseable = Yes
Valid users = gongxiang # Before this operation, we have created a new account name: shared common account, and have full permission to this directory as agreed!
3. Let's cancel SELinux's samba restrictions!
3.1 view SELinux's samba settings
[Root @ host ~] # Getsebool-A | grep samba
Samba_enable_home_dirs --> off
Samba_cmd_nfs --> off
Use_samba_home_dirs --> off
3.2 remove SELinux's samba restrictions
[Root @ host ~] # Setsebool-P samba_enable_home_dirs 1
3.3 check SELinux's samba settings.
[Root @ host ~] # Getsebool-A | grep samba
Samba_enable_home_dirs --> on
Samba_cmd_nfs --> off
Use_samba_home_dirs --> off
3.4 restart the samba Service
[Root @ host ~] # Service SMB restart
3.5: This Command Re-enables SELinux's samba restrictions (haha, you do not need to use)
[Root @ host ~] # Setsebool-P samba_enable_home_dirs 0