Samba configuration in linux

Source: Internet
Author: User

  • Main Purpose: achieve cross-platform file sharing between linux and windows

  • Samba uses the netbios protocol: This Protocol can only be implemented in the lan and cannot span network segments. Therefore, samba is widely used in the lan. In netbios, different host names are set for each host, work in the same working group.

  • Peer-peer workgroup Model

    All PCs manage their own accounts and passwords on their computers. To use the resources of the other party, you must log on to the other party's account and password.

  • Domain Model

    All accounts and passwords are placed on the same master machine. Anyone in this CIDR Block needs to enter their own accounts and passwords to use any computer. After domain host verification, resources and permissions are allocated, you do not need to know the password of another person.


Install samba Server

  • Install samba software: yum install samba *

  • Disable firewall and selinux (setenforce 0)

  • Configure smb. conf

No user authentication

1 name resolution: workgroup = wjzj (working group name)

Server string = this is a share host

Netbios name = lixueserver

2 Standalone Server Options:

Security = share

3 Share Definitions

Comment = Temporary file space
Path =/tmp
Read ony = no
# Public = yes

User Authentication

1 name resolution: workgroup = wjzj (working group name)

Server string = this is a share host

Netbios name = lixueserver

2 Standalone Server Options:

Security = user

Passdb backend = tdbsam

3 Share Definitions

[Homes]

Comment = Home Directories
Browseable = no
Writable = yes
Valid users = % S
Create mode = 0664
Directory mode = 0775
[Public]
Comment = the user group work directory
Path =/home/public
# Public = yes
Writable = yes
Valid users = @ huanghuang (accessible Group)

  • Check syntax correctness

    Testparm

  • Start the samba Service

    Service smb start

  • Check whether the port is enabled

    Netstat-tlunp

  • Client observation first self-check)

    Smbclient-L // 127.0.0.1. If it succeeds, the shared directory is displayed.

NOTE 1: The New samba version replaces smbpasswd with tdbsam, and adds the samba account and password with pdbedit-a username.

Pdbedit-v username displays the user information

NOTE 2: the samba user must already exist in the linux system. This user already has an entry in/etc/passwd. If no entry exists, create one, to use the group function in samba, you must be in smb. in the group configured in conf

Note 3: The user has write permission in smb. conf. If the linux underlying layer does not grant this permission, the user cannot perform write operations on the file. If you accidentally use root to create a shared file, remember to open the file permission to samba users.

Note 4: If it is smb. if the public function is enabled in conf, "one user is not allowed to use more than one user name to share resources with one server" may occur when windows connects to the server. We recommend that you disable public, use net use */del/y to disconnect the connection in cmd and try again

Ps: Modify the Host Name: In addition to modifying the host name with hostname lixueserver, you must also modify the host name in/etc/hosts and/etc/sysconfig/network.





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.