Samba File Sharing

Source: Internet
Author: User
Tags custom name

Samba functions are simple to achieve sharing between Linux and Windows.

 

Samba package composition

Samba-3.0.33-3.28.el5 server software is also the main program

Samba-common-3.0.33-3.28.el5 provides announcement components for server and client programs

Samba-client-3.0.33-3.28.el5 client software

Samba-swat-3.0.33-3.28.el5.i386.rpm for program software that provides Web Management

 

Main Program of Samba Server

Smbd: Provides shared access to files and print resources on the server

Nmbd: Provides resolution based on NETBIOS Host Name

The smbd process listens to port 139tcp to process incoming SMB packets;

The nmbd process listens to ports 137 and UDP, enabling other hosts to browse Linux servers.

 

 

Configuration content of the smb. conf file

[Global]: global settings

[Homes]: user directory sharing settings

[Printers]: printer sharing settings

[Share]: Set the shared directory with a custom name

 

Common configuration items and descriptions

Global Configuration

Workgroup: name of the workgroup

Serverstring: Server description

Security: Security Level share (anonymous), user (authentication username and password), server (another server must be specified), domain (verification by domain control)

Log File: Location of the log file

Max logsize: Maximum log file capacity, in KB

Passwdbackend: Set the file type of the shared account.

 

Meaning of shared directory configuration items

Comment: comments and descriptions of shared directories

Path: the actual path of the shared directory on the server.

Browseable: whether the shared directory is visible in "Network neighbors"

Guest OK: whether to allow access by all users, which is equivalent to "public"

Writable: whether it can be written. It is opposite to read-only.

Vetofiles: Restrict File Types

 

Build a file server

  1. Install Samba and filter file comments.

Mount and install samba

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/4C/wKiom1Pm3CSzXP0mAALOOaOWxDc929.jpg "Title =" image001.png "alt =" wkiom1pm3cszxp0maalooaowxdc929.jpg "/>

Filter File Content

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/4C/wKiom1Pm3DTgN6JBAAE3Nw8Lo6U719.jpg "Title =" image002.png "alt =" wkiom1pm3dtgn6jbaae3nw8lo6u719.jpg "/>

Import the filtered content to the configuration file

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/45/4C/wKioL1Pm3VjSOFb6AAEtTm-u0F8755.jpg "Title =" image003.png "alt =" wKioL1Pm3VjSOFb6AAEtTm-u0F8755.jpg "/>

2. Anonymous access and sharing

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/4C/wKiom1Pm3EiDa9Y6AAGQclzXuTo205.jpg "Title =" image004.png "alt =" wkiom1pm3eida9y6aagqclzxuto205.jpg "/>

Restart the service. The configuration takes effect.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/4C/wKiom1Pm3YmAc2-uAADoceZ-3jc937.jpg "Title =" image005.png "alt =" wKiom1Pm3YmAc2-uAADoceZ-3jc937.jpg "/>

Note:

1. After each configuration file is modified, restart the smb service to make the service take effect.

2. If no access is available, disable the SELinux command: setenforce 0.

 

3. User-verified sharing

3.1 create a samba user database.

The shared user corresponds to the System user. The password of the shared user can be set separately, which is different from that of the System user.

Pdbedit

-A: Add a system user.

-U: Specifies the user name.

-L: lists all user information.

-X: deletes user information.

 

3.2 Set User Access Permissions

Add a shared user of zhangsan

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/4C/wKioL1Pm3YezgdiQAAIA3U5b4pc917.jpg "Title =" image006.png "alt =" wkiol1pm3yezgdiqaaia3u5b4pc917.jpg "/>

Add zhangsan to access sharing. To add a group, add @ to the group name @

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/4C/wKiom1Pm3HyC9P6jAAFVuAYR0Bs925.jpg "Title =" image007.png "alt =" wkiom1pm3hyc9p6jaafvuayr0bs925.jpg "/>

3.3 confirm Directory Access Authorization

Directory Access authorization, which is different from local access permissions.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/4C/wKiom1Pm3gfSrU4wAAFVuAYR0Bs381.jpg "Title =" image007.png "alt =" wkiom1pm3gfsru4waafvuayr0bs381.jpg "/>

4. User ing and access address restrictions

4.1 shared account ing (alias)

Modify/etc/samba/smbusers

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/4C/wKiom1Pm3Ney5yINAACTGArQotY255.jpg "Title =" image009.png "alt =" wkiom1pm3ney5yinaactgarqoty1_jpg "/>

Load the alias file in the configuration file

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/45/4C/wKiom1Pm3OXDp53GAAFsN01Mkes803.jpg "Title =" image010.png "alt =" wkiom1pm3oxdp53gaafsn01mkes803.jpg "/>

Then restart the service and zhangsan can log on to the server using Lisi.

 

4.2 Access address restrictions

For example, only access from the 192.168.1.0 CIDR block is allowed.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/4C/wKiom1Pm3Pag5yTTAAF2oMd95bI158.jpg "Title =" image011.png "alt =" wkiom1pm3pag5yttaaf2omd95bi158.jpg "/>

5. Mount shared folders with Mount

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/4D/wKioL1Pm3h6ByTd5AAGQh06BYaE620.jpg "Title =" image012.png "alt =" wkiol1pm3h6bytd5aagqh06byae620.jpg "/>

 

 

 


This article from the "plum blossom from bitter cold" blog, please be sure to keep this http://wangjunkang.blog.51cto.com/8809812/1538130

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.