Install and configure the Samba server in CentOS 7

Source: Internet
Author: User

Install and configure the Samba server in CentOS 7

Notes on the installation and configuration process of the Samba server in CentOS 7.

Suppose we have such a scenario

Share Name Path Permission
SHAREDOC /Smb/docs All personnel, including guests, can access
RDDOCS /Smb/tech Allow read/write access only to users in a specific group

The group name is RD. Currently, Alice, Jack, and Tom are three people.

Install Samba

# Yum-y install samba-client samba-common
// Or use rpm for Installation
# Rpm-ivh samba-4.1.1-37.el7_0.src.rpm
// View the installation version
# Rpm-qi samba
Name:
Samba
Epoch:
0
Version: 4.1.1
Release:
37. el7_0
Architecture: x86_64
Install Date: Mon 11 Aug 2014 05:10:39 PM CST
Group:
System Environment/Daemons
Size:
1657523
License:
GPLv3 + and LGPLv3 +
Signature:
RSA/SHA256, Wed 06 Aug 2014 03:59:24 am cst, Key ID 24c6a8a7f4a80eb5
Source RPM:
Samba-4.1.1-37.el7_0.src.rpm
Build Date:
Wed 06 Aug 2014 03:33:22 AM CST
Build Host:
Worker1.bsys.centos.org
Relocations: (not relocatable)
Packager:
CentOS BuildSystem Vendor:
CentOS
URL: http://www.samba.org/
Summary:
Server and Client software to interoperate with Windows machines
Description:
Samba is the standard Windows interoperability
Suite of programs for Linux and Unix.
Tips: Also the previous major change in SAMBA 3 is:
Security no longer supports share
WARNING: Ignoring invalid value 'share 'forparameter 'security'

Configure the Samba server

Create a shared directory (assuming files under the shared/smb directory)
# Mkdir-p/smb/docs
# Mkdir-p/smb/tech

Configure Kernel Parameters
# Ulimit-n 16384
# Vi/etc/security/limits. conf
# Add the following content at the end
*-Nofile 16384

Tip: This mainly prevents the following warning information when starting Samba:
Rlimit_max: increasing rlimit_max (1024) tominimum Windows limit (16384)


# Cd/etc/samba/
// Back up the original configuration file
# Cp smb. conf smb. conf. origin

# Vi/etc/samba/smb. conf
Delete all original content and add the following content:
[Global]
Workgroup = BIGCLOUD
Netbios name = ZZSRV2
Server string = Samba Server
# Security = share
Security = user
Map to guest = Bad User
[Mongodocs]
Path =/smb/docs
Readonly = yes
Browseable = yes
Guest OK = yes
[RDDOCS]
Path =/smb/tech/
Public = no
Writable = yes
Write list = @ RD
Validusers = @ RD

Create a user and assign Permissions

// Create an operating system user
# Useraddalice
# Useraddjack
# Useradd tom
# Useradd RD

// Modify the user group
# Usermod-a-g rd alice
# Usermod-a-g rd jack
# Usermod-a-g rd tom
# Id alice
Uid = 1000 (alice) gid = 1000 (alice) groups = 1000 (alice), 1003 (RD)

// Create a SAMBA user
# Smbpasswd-a alice
# Smbpasswd-a jack
# Smbpasswd-a tom

// Modify directory permissions
# Chown RD: RD/smb/tech/
# Chmod 770/smb/tech
// View the service status
# Ll-d/smb/tech/
Drwxrwx --- 2 RD 4096 Aug 11/smb/tech/

# Systemctlrestart smb
# Systemctlenable smb
# Systemctlstatus smb
Smb. service-Samba SMB Daemon
Loaded: loaded (/usr/lib/systemd/system/smb. service; enabled)
Active: active (running) since Tue2014-08-12 11:38:29 CST; 14 s ago
Main PID: 16807 (smbd)
Status: "smbd: ready to serveconnections ..."
CGroup:/system. slice/smb. service
16807/usr/sbin/smbd
16808/usr/sbin/smbd

Systemd [1]: Starting Samba SMB Daemon...
Smbd [16807]: [11:38:29. 255341, 0] ../lib/util/become_daemon.c: 136 (daemon_ready)
Systemd [1]: Started Samba SMB Daemon.
Smbd [16808]: STATUS = daemon 'smbd 'finished starting up and ready to serve connectionsfailedto retrieve print... CCESSFUL
Hint: Some lines were ellipsized, use-l to show in full.

Test connectivity

// Test on Linux
# Smbclient-L localhost-U alice % P @ ssw0rd
Domain = [BIGCLOUD] OS = [Unix] Server = [Samba 4.1.1]

Sharename Type Comment
--------------------
SHAREDOCS Disk
RDDOCS Disk
IPC $ IPC Service (Samba Server)
Domain = [BIGCLOUD] OS = [Unix] Server = [Samba 4.1.1]

Server Comment
----------------

Workgroup Master
----------------
// Test on Windows
C: \> netuse */del
You have the following remote connections:

\ 192.168.1.18 \ d $
The connection will be canceled if you continue running.

Do you want to continue this operation? (Y/N) [N]: y
The command is successfully completed.


C: \> netuse \ 192.168.188.12 P @ ssw0rd/U: alice
The command is successfully completed.

Open Resource Manager for write Test

-------------------------------------- Split line --------------------------------------

The speed of accessing samba from Ubuntu dual Nic of VMWare Virtual Machine doubles

Add the Samba File Sharing Server to the Windows Server 2003 Domain

Samba installation Configuration

Samba service configuration in CentOS 6.2

Build a Samba server in CentOS 6.5

How to Build the Win7 + VMware + Fedora18 Samba Server

-------------------------------------- Split line --------------------------------------

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.