Samba installation and basic application

application background
In the Windows environment, use Samba to access the shared directory of the Linux server.
 

system environment

  • Operating System: CentOS 7
  • Samba server IP address: 192.168.0.104
 
Steps
1 Install Samba
[root@localhost ~]# rpm -q samba
package samba is not installed
[root@localhost ~]# yum install samba samba-client samba-common
After the installation is complete, execute rpm -q samba again
[root@localhost ~]# rpm -q samba
samba-4.2.10-7.el7_2.x86_64
 
The composition and use of two Samba services
The operation of Samba consists of two services, one is SMB and the other is NMB. SMB is the core startup service of Samba. Only when the SMB service is started can file sharing be realized. The NMB service is responsible for parsing, similar to the function implemented by DNS. NMB can associate the workgroup name shared by the Linux system with the IP. If the NMB service is not started, the shared files can only be accessed through the IP.
 
Three core configuration file smb.conf
The smb.conf file is in the /ect/samba directory.
1. The [global] section is configured as follows
2. The [home] section is configured as follows

 
Four configuration other considerations
1. Under the Linux operating system, the firewall-related operations are as follows
[root@localhost ~]# setsebool -P samba_enable_home_dirs on
[root@localhost ~]# iptables -F
2. In Windows operating system, you need to close unnecessary connections
net use * /delete /y
3. Increase the samba user password
[root@localhost ~]# smbpasswd -a cakin24
 
Five reboot SMB
[root@localhost ~]# systemctl restart smb.service
[root@localhost ~]# ps -ef|grep smb
root      4439     1  0 20:51 ?        00:00:00 /usr/sbin/smbd
root      4442  4439  0 20:51 ?        00:00:00 /usr/sbin/smbd
root      4561  3832  0 20:51 pts/1    00:00:00 grep --color=auto smb
 
六 在Windows下访问Samba服务器的共享文件
1、在地址栏输入Linux的IP地址。
\\192.168.0.104
2、弹出登录对话框,输入cakin24和相应的密码。
3、进入共享目录。

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326435966&siteId=291194637