In Linux, samba is an open source software based on the SMB protocol. It is a software that allows the Linux system to apply the Microsoft network communication protocol. The samba software can be used for file sharing between Windows and Linux, and for resource sharing between Linux and Linux.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
1. Introduction to samba
Samba is available on Linux and UNIX A free software that implements the SMB protocol on the system, consisting of server and client programs.
SMB is a communication protocol for sharing files and printers on a local area network. It provides sharing services for files, printers and other resources between different computers in the local area network.
The SMB protocol is a C/S type protocol through which clients can access shared file systems, printers and other resources on the server.
samba is a software that allows Linux systems to apply Microsoft network communication protocols. The biggest function of samba is that it can be used for direct file sharing and print sharing between Linux and windows systems. samba can be used for both windows. File sharing with Linux can also be used for resource sharing between Linux and Linux.
Samba service composition
1) SMB is the core startup service of samba. It is mainly responsible for establishing a dialogue between the Linux samba server and the samba client and verifying user identity. It also provides access to the file and printing system. Only when the SMB service is started can file sharing be realized and monitor the 139 TCP port.
2) The NMB service is responsible for resolution. It is similar to the function implemented by DNS. NMB can match the workgroup name shared by the Linux system with its IP. If the NMB service is not started, it can only be accessed through IP. Access shared files and listen on UDP ports 137 and 138.
Install samba service
yum -y install samba
Check the installation status
rpm -qa | grep samba
2. samba listening port
TCP | UDP |
---|---|
137 | 138 |
3. samba process
corresponds to | |
---|---|
corresponds to netbios | |
corresponds to cifs protocol | |
corresponds to Windows AD active directory |
4. samba user
smbpasswd -a USERNAME | command
|
The Samba server has three security levels, They are user, server, domain
server | |
domain | |
/etc/samba/smb.conf (main configuration File)
[homes] | ||||||||||||||||||||||||||||||||||||||||||
[printers] | ||||||||||||||||||||||||||||||||||||||||||
7. 常用配置文件参数
#测试配置文件是否有语法错误,以及显示最终生效的配置。使用 testparm 命令 [root@localhost ~]# testparm Load smb config files from /etc/samba/smb.conf rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384) Processing section "[homes]" Processing section "[printers]" Processing section "[print$]" Loaded services file OK. Server role: ROLE_STANDALONE ...... Copy after login 二、搭建匿名用户共享服务器(Linux - Linux)1. 环境准备
systemctl stop firewalld && systemctl disable firewalld setenforce 0 yum -y install ntp && ntpdate ntp.aliyun.com //server hostnamectl set-hostname server su //client hostnamectl set-hostname client su Copy after login 2. 服务端 yum -y install samba-* &> /dev/null systemctl start smb && systemctl enable smb #添加全局配置 vim /etc/samba/smb.conf ...... [global] workgroup = SAMBA security = user map to guest = Bad User ...... #创建共享文件夹 mkdir -p /opt/yc chmod 777 /opt/yc/ ll /opt/ #配置共享 cat >> /etc/samba/smb.conf << EOF [yc] comment = yc path = /opt/yc browseable = yes guest ok = yes writable = yes public = yes EOF #测试配置文件是否有误 testparm #重启服务 systemctl restart smb Copy after login 3. 客户端 yum -y install samba-* &> /dev/null systemctl start smb && systemctl enable smb #客户端验证 smbclient -L 192.168.10.20 -U 'Bad User' #123456 mkdir -p /opt/smb mount -t cifs //192.168.10.20/yc /opt/smb/ -o username='Bad User' df -h #在客户端上创建共享目录,文件 cd /opt/smb/ && touch test && mkdir yanchuang ls Copy after login 4. 服务端上验证 [root@server ~]#cd /opt/yc [root@server /opt/yc]#ls test yanchuang Copy after login 三、Windows 访问共享文件
相关推荐:《Linux视频教程》 The above is the detailed content of What is samba in linux. For more information, please follow other related articles on the PHP Chinese website!
Previous article:What does linux nfs mean?
Next article:How to check whether a certain software is installed in Linux
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Latest Issues
Related Topics
More>
|