Install Samba in Linux

Source: Internet
Author: User

*****************************
*****************************

Install Samba in Linux

*****************************
*****************************

To share resources between a Windows host and a Linux server, the Linux operating system provides the samba service. The SAMBA service builds a bridge between two different operating systems, it enables communication between Linux and Windows systems, providing great convenience for a wide range of Linux enthusiasts. This article briefly introduces how to set up a Samba server and simple configuration on a Linux operating system.

 

1. Service Query

By default, a part of the samba service package has been installed in Linux by default. To have a complete understanding of the entire process, uninstall this part first. Use commands

Rpm-Qa | grep Samba. By default, two existing packages can be queried:

Samba-client-3.0.33-3.7.el5

Samba-common-3.0.33-3.7.el5

 

2. Uninstall samba

Run rpm-e to uninstall the two packages. For the samba-common-3.0.33-3.7.el5, because there is a dependency between it and other RPM packages, the parameter-F and -- nodeps must be added,-F is mandatory, -- nodeps is not checked dependency, the complete command is:

Rpm-e samba-common-3.0.33-3.7.el5-f -- nodeps

Rpm-e samba-client-3.0.33-3.7.el5-f -- nodeps

 

3. Install samba

Run the following command to install the SDK:

Rpm-IVH samba-3.0.33-3.29.el5_6.2.i386.rpm-f -- nodeps

Rpm-IVH samba-client-3.0.33-3.29.el5_6.2.i386.rpm-f -- nodeps
Rpm-IVH samba-common-3.0.33-3.29.el5_6.2.i386.rpm-f -- nodeps
After the installation is complete, run the command rpm-Qa | grep Samba to query and find that all the servers on which the Samba server is built have been installed.

 

4. Configure the smb. conf file

Samba configuration files are generally stored in the/etc/samba directory. The main configuration file name is SMB. conf, which records a large amount of rules and shared information. Therefore, it is a very important core configuration file for the samba service. Most of the main configurations for completing Samba Server SETUP are carried out in this file.

The working principle of the Samba server is that the client initiates a request to the Samba server to access the shared directory. the Samba server receives the request and queries the SMB. CONF file to check whether the shared directory exists and the visitor's access permissions. If the visitor has the corresponding permissions, the client is allowed to access it, finally, the system information and user access behavior information collected during access are stored in the log file.

Step 1: modify the configuration file
First, back up the samba configuration file.

CD/etc/samba

MV smb. conf SMB. confbak

Then create a new smb. conf file.

Touch smb. conf

Then we write this section into smb. conf.

[Global]

Workgroup = linuxsir
NetBIOS name = linuxsir05
Server String = Linux Samba server testserver
Security = Share

[Linuxsir]
Path =/opt/linuxsir
Writeable = Yes
Browseable = Yes

Guest OK = Yes

 

Note:

[Global] This section is a global configuration and is required. There are the following rows;

Workgroup is the working group displayed in windows. Here I set linuxsir (in upper case );
NetBIOS name is the name of the computer displayed in windows;
Server String is the description of the Samba server, which can be defined by yourself. This is not important;
Security is the authentication and login method. Here we use share. There are many authentication methods, one of which is also commonly used as the user authentication method. If share is used, you do not need to set the user and password;

[Linuxsir] the shared directory is displayed in windows;
Path = You can set where the directory to be shared is stored;
Whether writeable can be written. Here I set it to writable;
Whether browseable can be viewed or not. If browsed, we can see shared folders under the Working Group. If you do not want to display it, set it to browseable = No.

Guest OK anonymous users log on as guest;

Step 2: create a directory and grant permissions;

[Root @ localhost ~] # Mkdir-P/opt/linuxsir

[Root @ localhost ~] # ID nobody
Uid = 99 (nobody) gid = 99 (nobody) groups = 99 (nobody)
[Root @ localhost ~] # Chown-r nobody: Nobody/opt/linuxsir

Note:

For nobody authorization, we first use the id command to view the information of the nobody user. It is found that the user group is also nobody. We must take this as the standard. In some systems, the nobody user group is not the nobody;

 

Step 3: Start smbd and nmbd servers;

[Root @ localhost ~] # Smbd

[Root @ localhost ~] # Nmbd

 

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.