First, install the software on the server side and configuration (hereinafter root operations required for the user):
1、安装samba: yum -y install samba samba-client
2, start the service and set the boot: systemctl start smb, systemctl enable smb
3, create a shared file: mkdir / public
4, establish a security context: chcon -t samba_share_t / public
5, create smb user: useradd smbuser -s / sbin / nologin
6, add a password for the user: smbpasswd -a smbuser
7, provided other user has write access: chmod o + w / public
8, writes the following final surface configuration file: vim /etc/samba/smb.conf
[public]
path = /public
hosts allow = 10.0.0. // here all the host network segment
browseable = yes
farmers list = smbuser
9, add the relevant service to the firewall, and reload the firewall
1) firewall-cmd --permanent --add-service=samba
2) firewall-cmd --permanent --add-service=rpc-bind
3) firewall-cmd --permanent --add-service=mountd
4) firewall-cmd --reload
10, restart the service: systemctl restart smb
Second, the client configuration:
1、yum -y install samba-client cifs-utils
2, create a mount file: mkdir / smbfile
3, add the following to / etc / fstab file: vim / etc / fstab
//10.0.0.20/public /smbfile cifs defaults,username=smbuser,password=123456,multiuser 0 0
4, mount the file: mount / smbfile
Third, direct input access windows in: \\ 10.0.0.20, and then enter the correct user name and password.
PS: You can also enter the linux client in: after smbclient //10.0.0.20/public -U smbuser, enter the correct user name and password to access directly. Further, as the other user does not have write access samba, you can run the command: cifscreds add 10.0.0.20 -u smbuser write privileges.