CENTOS7 Installation Configuration Samba server

Source: Internet
Author: User

Suppose we have such a scene

Share name Path Permissions
Sharedoc /smb/docs All people, including guests, can access
Rddocs /smb/tech Allow read-write access only to users of a specific group

The group name for a specific group is Rd, and the current Alice, Jack, and Tom three people

Installing Samba

123456789101112131415161718192021222324252627282930313233343536373839404142 # yum -y install samba samba-client samba-common //或者使用rpm安装#rpm -ivh samba-4.1.1-37.el7_0.src.rpm//查看安装版本信息# rpm -qi sambaName        :sambaEpoch       :0Version     : 4.1.1Release     :37.el7_0Architecture: x86_64Install Date: Mon 11 Aug 2014 05:10:39 PM CSTGroup       :System Environment/DaemonsSize        :1657523License     :GPLv3+ and LGPLv3+Signature   :RSA/SHA256, Wed 06 Aug 2014 03:59:24 AM CST, Key ID 24c6a8a7f4a80eb5Source RPM  :samba-4.1.1-37.el7_0.src.rpmBuild Date  :Wed 06 Aug 2014 03:33:22 AM CSTBuild Host  :worker1.bsys.centos.orgRelocations : (not relocatable)Packager    :CentOS BuildSystem //bugs.centos.org>Vendor      :CentOSURL         : http://www.samba.org/Summary     :Server and Client software to interoperate with Windows machinesDescription :Samba is the standard Windows interoperabilitysuite of programs forLinux and Unix.Tips:也之前的SAMBA 3有一个重大的变化是:security不再支持shareWARNING: Ignoring invalid value ‘share‘forparameter ‘security‘

Configuring the Samba server

1234567891011121314151617181920212223242526272829303132333435363738 创建共享目录(假设共享/smb目录下的文件)# mkdir -p /smb/docs# mkdir -p /smb/tech 配置内核参数# ulimit -n 16384# vi /etc/security/limits.conf#在最后加入以下内容* - nofile 16384 Tip: 这主要是避免在启动Samba时出现以下警告信息:rlimit_max: increasing rlimit_max (1024) tominimum Windows limit (16384)  # cd /etc/samba///备份原有的配置文件# cp smb.conf smb.conf.origin  # vi/etc/samba/smb.conf删除原有所有内容,添加如下内容:[global]  workgroup=BIGCLOUD  netbios name=ZZSRV2  server string=Samba Server  #security=share  security=user  map to guest = Bad User[SHAREDOCS]  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

123456789101112131415161718192021222324252627282930313233343536373839404142 //创建操作系统用户# useraddalice# useraddjack# useradd tom# useradd RD //修改用户的组# usermod -a-G RD alice# usermod -a-G RD jack# usermod -a-G RD tom# id aliceuid=1000(alice) gid=1000(alice)groups=1000(alice),1003(RD) //创建SAMBA用户# smbpasswd-a alice# smbpasswd-a jack# smbpasswd-a tom //修改目录权限# chown RD:RD/smb/tech/# chmod 770/smb/tech//查看服务状态# ll -d/smb/tech/drwxrwx--- 2 RD RD 4096 Aug 11 17:08 /smb/tech/ # systemctlrestart smb# systemctlenable smb# systemctlstatus smbsmb.service - Samba SMB Daemon   Loaded: loaded(/usr/lib/systemd/system/smb.service; enabled)   Active: active (running) since Tue2014-08-12 11:38:29 CST; 14s 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]:[2014/08/1211: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...CCESSFULHint:Some lines were ellipsized, use -l to show infull.

Test connectivity

12345678910111213141516171819202122232425262728293031  //Linux上测试# smbclient-L localhost -U alice%[email protected]Domain=[BIGCLOUD] OS=[Unix] Server=[Samba 4.1.1]         Sharename       Type      Comment       ---------       ----      -------       SHAREDOCS       Disk       RDDOCS          Disk       IPC$            IPC       IPC Service (Samba Server)Domain=[BIGCLOUD] OS=[Unix] Server=[Samba 4.1.1]        Server               Comment       ---------            -------        Workgroup            Master       ---------            ------- //Windows上测试C:\>netuse * /del您有以下的远程连接:                    \\192.168.1.18\d$继续运行会取消连接。 您想继续此操作吗? (Y/N) [N]: y命令成功完成。  C:\>netuse \\192.168.188.12 [email protected] /U:alice命令成功完成。 打开资源管理器进行写入测试

This article is from the "Li Hao" blog, make sure to keep this source http://leaus.blog.51cto.com/9273485/1540729

CENTOS7 Installation Configuration Samba server

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.