Directory
1. Introduction to samba
Second, the advantages of samba
3. Service scenarios of samba
4. Experiment of Centos7 shared service samba setting
Purpose:
Experiment content:
1. Install the shared service
2. Modify the smb.conf configuration file and set the share
3. Access the share with an account (user):
1. Introduction to samba
Samba is an open source software that enables file and print sharing between Linux and other operating systems. Samba allows computers with different operating systems to share resources and communicate with each other in the same network.
In CentOS 7, to install the Samba server, you first need to install the Samba package using the following command:
sudo yum install samba
After installation, you need to edit the Samba configuration file (/etc/samba/smb.conf) to configure the Samba share. You can open and edit this file with a text editor, such as vim or nano.
In the Smb.conf file, you need to specify details such as the share name, the path to the share, and the users who can access the share. For example, the following is a sample shared configuration.
[share_folder] comment = Shared Folder path = /home/username/share_folder/ browseable = yes writable = yes guest ok = no valid users = your_username
In this example, share_folder is the name of the share, /home/username/share_folder is the path to the share, and your_username specifies the user who can access the share.
After editing the shared configuration file, remember to restart the Samba service:
sudo systemctl restart smb.service
Now, on Windows or another computer, you can use a file manager to browse to the CentOS server’s shared location and access the files within it.
2. Advantages of samba
Samba is a very powerful software, here are some of its advantages:
1. Cross-platform: Samba can share files and printers on different operating systems. It supports platforms such as Windows, Linux, and Unix, and can realize communication between different platforms.
2. Easy to configure: The configuration of Samba is simple and can be realized by editing text configuration files. It is very easy to use and maintain for users who are familiar with Linux.
3. Security: Samba provides many security features, such as authentication and encrypted transmission, to better protect shared data.
4. Scalability: Samba can be extended to a large network environment and can support hundreds of concurrent users to access shared resources.
5. Open source and free: Samba is an open source software that anyone can use, modify and distribute for free.
In general, Samba provides users with a simple and effective way to share files and printer resources between different platforms, ensuring smooth communication between different operating systems.
3. Service scenarios of samba
Samba has a wide range of service scenarios, the following are some typical application scenarios:
1. Sharing files and data: Samba allows computers with different operating systems to share files and data, making team collaboration easier and more convenient, and helping to improve work efficiency.
2. Print sharing: Samba can also realize printer sharing, which is convenient for multiple computers or devices to use one printer at the same time.
3. Resource sharing: Samba can also share other resources, such as DVDs, CD-ROMs, tapes, directories, and applications, so that multiple computers or devices can collaborate and share resources.
4. Unified identity authentication and LDAP: Samba can be used as the main domain controller, supporting unified identity authentication and LDAP of Windows, Linux, UNIX and other platforms, which is convenient for enterprises or institutions to realize unified user management.
5. Remote file system protocol support: Samba also supports CIFS, SMB, NTFS and other remote file system protocols, enabling users to access remote file systems through the network.
On the whole, Samba has a wide range of applications in scenarios such as enterprises, education, government agencies, organizations, and families.
4. Experiment of Centos7 shared service samba setting
Experiment purpose:
1. Learn to build a file sharing server
2. Learn to access shared folders
Experiment content:
1. Install shared service
# yum -y install samba
Experiment screenshot 1-1.jpg
2. Modify the smb.conf configuration file and set up sharing
# vi /etc/samba/smb.conf [centos7] comment = Centos7 DVD directory. path = /media public = yes read only = yes
Enter the above content to define a new read-only shared centos7, the physical directory is
/media # mkdir /media # mkdir /media/cdrom/ # mount /dev/cdrom /media/cdrom/
Mount the CD to /meda/cdrom to facilitate remote access by users.
# systemctl start smb (start sharing) # testparm (confirm the parameters are ok)
Experiment screenshot 1-2.jpg
3. Access share with account (user):
A: Set up an account:
# useradd vina # pdbedit -a –u vina
(Password Aa123456)
(Re-enter password Aa123456)
Experiment screenshot 1-3.jpg
B: Set up security access
# systemctl stop firewalld # setenforce 0 # sestatus -b | grep samba (use the command to understand the current security access status)
Experiment screenshot 1-4.jpg
C: Access the share on the client
Open a window and enter \192.168.168.129 in the address bar
In the login window, enter username: vina, password: Aa123456
Experiment screenshot 1-5.jpg
Thank you so much for watching and allowing me to answer your questions about the Samba share service. Hope to bring you some help. Thanks again and wish you a nice day!
Of course, in addition to Samba, there are other shared services.
Here are some common shared services:
1. NFS (Network File System): NFS is a protocol for sharing files and directories between Unix and Unix-like systems. NFS clients can access remote file systems just like local file systems.
2. FTP (File Transfer Protocol): FTP is a commonly used Internet file transfer protocol, which allows users to access and transfer files through an FTP client, and can be used for file sharing and backup tasks.
3. SSH (Secure Shell): SSH is an encrypted remote login protocol, which can remotely access the server and execute commands, and can also transfer files through SFTP (SSH File Transfer Protocol).
4. WebDAV (Web-based Distributed Authoring and Versioning): WebDAV is a web-oriented protocol that uses the HTTP protocol for file sharing and modification, and supports version control.
5. CIFS (Common Internet File System): CIFS is a file sharing protocol developed by Microsoft, which can be used for file sharing among different platforms such as Windows, Mac, Linux and UNIX.
Different shared services have different characteristics, advantages and disadvantages, and the selection of a suitable shared service needs to be determined according to actual needs.