Test the Samba server-Linux Enterprise Application-Linux server application information. The following is a detailed description. 1. What is Samba?
Samba can be considered as a file server on a LAN. It can provide file services and printing services for customers in the same network (such as Win95 and WinNT. That is to say, the Samba server enables LINUX to implement functions provided by file servers like Novell Netware.
2. How Samba works
The working principle of Samba is to allow NETBIOS (Communication Protocol of Windows95 network neighbor) and SMA Server Message Block) to run on TCP/IP communication protocol, in addition, the NETBEUI protocol of Windows 95 enables LINUX to be seen by Windows 95 on network neighbors.
The most important protocol is the SMB protocol (Server Message Block), which is used to share printers, serial ports, and abstract communication (such as Named Pipes and mail slots) between different computers. SMB is a very important protocol, which is widely used in all Microsoft Windows operating systems.
Samba is the implementation of SMB servers on UNIX-like systems. It is open-source GPL free software. Currently, Samba can run on almost all UNIX variants.
3. Install the Samba server
In the RedHat LINUX operating system, if Samba is selected during installation, it will install Samba while installing LINUX. If you do not have any options, you can also find the Samba RPM installation package on the disc and use RPM to install it.
4. Configure Samba
The job of configuring Samba is to set the configuration file smb. conf. Smb. conf is related to Samba server permission settings, as well as various detailed options such as shared directories, printers, and working groups of machines.
The syntax of file smb. conf is very clear. The file is divided into segments. The names of each segment are enclosed in square brackets. Set parameters in the format of "name = value" in each segment. The first plus sign indicates that the sentence is a comment. In the subsequent sections, we will only describe the most common and basic sections. For more in-depth settings, please read the comments in this document.
The configuration file contains three special segments.
1. Global segment: configure the parameters used by the server throughout the process, and provide default values for other segments.
[Global]
Workgroup = MYGROUP
; Hosts allow = 192.168.1. 192.168.2. 127.
Printcap name =/etc/printcap
Load printers = yes
Log file =/var/log/samba/log. % m
1) The first workgroup is used to specify the working group where the machine is located in the network neighbor. The default value is MYGROUP. You can modify it based on your preferences.
2) hosts allow is a description used to specify which machines in the LAN can use the Samba service. Generally, you do not need to set this parameter. Therefore, you can start with ";" to comment out this sentence.
3) The third sentence tells Samba where the printer name is located.
4) The fourth line load printers = yes indicates that the Samba server is allowed to browse all the printers.
5) The last sentence specifies the storage address of log files.
2. Homes segment: this segment is used to indicate the main directory of the user that allows the client to connect. The smb. conf file does not contain the specific content of this directory. When a service request is sent, find this specific service in the other part of the smb. conf file. If this service is not found and the homes segment is provided, search for the password file to find the user's home directory. By breaking down the Homes segment, Samba enables the user's main directory to be used for sharing. The following are the basic settings for this section.
[Homes]
Comment = Home Directory
Browseable = no
Writable = yes) the comment specifies the shares that can be used by the client on the server.
2) browseable sets whether to display the directory of Samba in the network browsing table. We recommend that you change it to browseable = yes.
3) The last sentence indicates whether you have the write permission.
3. Printers segment: Set the printer sharing status. The sample is shown in the following table:
[Printers]
Comment = All printers
Browseable = no
Printable = yes
We recommend that you change browseable = no to browseable = yes.
Generally, the most basic settings have been made in the default smb. conf file, and can be applied in multiple situations without any modifications. Therefore, it is recommended that you do not need to modify it for beginners. Of course, if necessary, you can refer to the comment statement for some attempts.
That is to say, if you do not modify smb. conf, the client can use the most basic Samba service.
4. Start the Samba server
There are two methods to start the Samba server. One is standalone and the other is Inted:
The startup method occupies the resource response speed
Standalone
Inted mode is less slow
We recommend that you use the Inted method to start the Samba server. Note that you cannot run the Samba server in two ways at the same time. Otherwise, the Samba service may become unhealthy. This method is also used by default.
) Use Inted to start:
When Samba is installed, the following lines are added to the/etc/services file:
Netbios-ns 137/tcp
Netbios-ns 137/udp
Netbios-dgm 138/tcp
Netbios-dgm 138/udp
Netbios-ssn139/tcp
Netbios-ssn139/udp
The following lines are added to the/etc/inetd. conf file:
Netbios-ssn stream tcp nowait root/usr/sbin/smbd
Netbios-ns dgram udp wait root/usr/sbin/nmdb
If you want to start it in one of the following ways, add a comment symbol "#" before them, and then execute the inetd command to make the modification take effect.
2) Start With Standalone
If you want to start in this way, add the following lines to the/etc/rc. d/rc. local file:
Echo "startingsamba Server ......"
/Usr/local/samba/bin/smbd? D-d1
/Usr/local/samba/bin/nmbd? D? D1? N LINUX
5. Use the Samba Service
Taking Windows 9x as an example, we can find a new working group MYGROUP, And the LINUX host is displayed below as long as we open the network neighbor. We can use the Samba service.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service