Linux Foundation---SMB configuration

Source: Internet
Author: User

I. Introduction of SAMBA

1. Overview:

For Windows ' Network Places, the way to share files is using the NFS protocol between the SMB and CIFS protocols and the NetBIOS protocol Linux/unix. But there is no sharing between Linux and Windows, so Andrew Tridgell of the Australian National University decided to develop a software that would enable file sharing between different systems. That is, Samba was born. for those of us who are learning Linux, Samba is a bridge between Linux and windows that allows us to communicate between Linux and Windows, and most fundamentally we can copy files. and the sharing of resources between different systems.

2. Application Scenario:

File and Printer Sharing: The SMB process implements resource sharing and publishes files and printers to the network for user access.

Authentication and permission settings: The SMBD service supports authentication and permission settings modes such as user mode and domain mode to protect shared files through encryption.

Name resolution: Samba resolves the computer's NetBIOS to a corresponding IP address by NMBD build NBNS (NetBIOS Name Service) for name resolution

Browsing services: In a local area network, the Samba server can be the landlord Browse Server, save a list of resources, and save a list of available resources.

3, Working principle:

When the client accesses the server, it is transmitted through the SMB protocol. The specific process is as follows:

(1), agreement negotiation:

When the client accesses the SMB server, a Negprot instruction packet is sent to the computer that supports the SMB,SMB server to select the optimal SMB response based on the client's request:

Client---------------Send Negprot requests-----------------server side

Client------------<--Negprot response-----------------Server side

(2), recommended connection

When the SMB type is determined, the client sends the session, sets up the instruction packet, submits the account and password, requests a connection to the SMB server, and if authentication passes, the SMB server responds to the session creation message and assigns a UID to the user to use when communicating with it.

Client---------------session Setup request----------------server side

Client------------<--Session setup responds-----------------server side

(3), access to shared resources

When a client accesses a server resource, it sends a tree Connect directive that notifies the server of the shared resource name that needs to be questioned, and if set allows, the server assigns a TID between each client and the shared resource connection so that the client can access the required shared resources

Client---------------send a tree connect request----------------server side

Client------------<--Tree Connect response-----------------Server side

(4), disconnect

When the shared use is complete, the client sends a tree disconnect message to the server to close the share and disconnect from the server

Client---------------send a tree disconnect request-----------------server side

Client------------<--Disconnect Response-----------------server side

Ii. Examples of Linux configurations

share a directory, use a user name and password to log in before you can access, requirements can read and write

Steps:

1. Install Samba:

Yum Install-y Samba Samba-client

After the installation is complete, you can use the following command to view:

Rpm-qa Samba #qa为 (query all) abbreviation

2. configuration file/etc/samba/smb.conf

To configure:

To edit a Samba configuration file:

Vim/etc/samba/smb.conf

Find [Global]

Put security = Share

Change to security = user

Note [home] module

Add the following modules at the end:

Add to:

[MyShare]

Comment = Share for users

Path =/samba

browseable = yes

writable = yes

public = No

#public = no disables anonymous account login

To save the configuration file, create the directory :

Mkdir/samba

chmod 777/samba

To create a system account:

Useradd user1

Useradd User2

Add user1 and user2 to your samba account:

Pdbedit-a user1

# Follow the prompts to enter the password

Pdbedit-a User2

List All of Samba's accounts:

Pdbedit-l

Restart Service:

Service SMB Restart

3, to test:

On Linux ifconfig, you will get an IP address to test: for example, my PC:

Browser input:

File://192.168.89.131/myshare/

or enter it in the Windows Runtime:

\\192.168.89.131

-------------------------Configuration Complete--------------------------------

Iii. Summary

The above is a brief introduction and configuration of Samba.

Linux Foundation---SMB configuration

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.