Original Reference:
https://blog.csdn.net/qq_38410730/article/details/80500920
https://blog.51cto.com/13728740/2137366
https://blog.csdn.net/weixin_42342456/article/details/82390184
1. Basic environment
Environment Configuration |
Server |
Client |
system |
CentOS 7.6 |
Windows 7 |
IP addresses |
192.168.5.254 |
|
install software |
samba |
|
Firewall state |
Close firewalld and selinux service |
Close windows firewall |
2. deploy samba service
( 1 ) installation process
yum -y install samba ## installed
rpm -qa | grep samba ## centos 7.6 in the installation is complete, then there will be six this file, if there is no explanation is not installed
samba-4.8.3-6.el7_6.x86_64
samba-client-libs-4.8.3-6.el7_6.x86_64
samba-libs-4.8.3-6.el7_6.x86_64
samba-common-tools-4.8.3-6.el7_6.x86_64
samba-common-4.8.3-6.el7_6.noarch
samba-client-4.8.3-6.el7_6.x86_64
samba-common-libs-4.8.3-6.el7_6.x86_64
( 2 ) Configure shared directory
cd /etc/samba
cp smb.conf{,.origin}
vim smb.conf
Note:
security value of the share is a shared sense, but here arranged to share being given, the selected User ;
Create a shared directory: share_linux , path is the path to it, the Comment is file a comment, explanation; the rest of the [homes] [printers] [print $] all commented out, save and exit.
( 3 ) to start the service
systemctl start smb
systemctl enable smb
( 4 ) create a login and user password
useradd smbuser
smbpasswd -a smbuser
( 5 ) modify the user's shared directory, otherwise it can not write to the client; If not the client has write permissions, you can not set
chown smbuser.smbuser /opt/share_linux
3. Testing
In the windows system, "Run", type: \\ 192.168.5.252 , press Enter;
Enter the user name just created log into;
Test Share
Server: cd / opt / share_linux
touch test.file
Test side: Create a folder share_win
problem:
( 1 ) Note that security setting value;
( 2 ) Note that when you set a password to create the user must use the smbpasswd ;
( 3 ) If you allow clients to upload files, it is necessary to set the owner and group of the shared directory for the logged-on user;
( 4 ) Note that the service side of the firewall policy settings to prevent interception.