Implementation of Samba shared services

Source: Internet
Author: User

Implementing SMB Sharing

1. Install the Samba package on the Samba server

Yum Install Samba-y

2. Create Samba users and groups

[Email protected] ~]# groupadd-r Amdin

[Email protected] ~]# useradd–s/sbin/nologin-g admin Wang

[Email protected] ~]# smbpasswd-a Wang #设置密码

[Email protected] ~]# useradd–s/sbin/nologinmage #mage用户不加入组是有理由的下面有介绍

[Email protected] ~]# Smbpasswd–a Mage

[Email protected] ~]#

3. Create a Samba shared directory and set SELinux

[Email protected] ~]# mkdir/apps/test

[Email protected] ~]# chgrp admin/apps/test

[[email protected] ~]# chmod 2775/apps/test# that 2 is special permission means that this directory has write permission for users created in this directory

belongs to a group of this directory

If SELinux should be disabled, it is no more than executing the following command.

[Email protected] ~]# semanage fcontext-a–t samba_share_t '/apps/test (/.*)? '

[Email protected] ~]# restorecon–vvfr/apps/test

4. Samba Server Configuration

[[Email protected] ~] #vim/etc/samba/smb.conf

Security = User

Passdb backend = Tdbsam

[Gongxiang]

Path =/apps/test

Write list = @admin # users in the user group again have write permissions, for example mage users do not.

Service SMB Restart #重启服务可以测试使用

5. Client Access

Install package

Yum Install Cifs-utils-y

Viewing shares on a samba server

Assuming there is no smbclient command, use the Yum install samba-client–y command to install

  [email protected]_1 gx]# smbclient -l 172.16.250.90 -u wang   enter wang ' s password:     #输入上文设置的密码   domain=[mygroup]  OS=[Unix] Server=[Samba 3.6.23-36.el6_8]  Sharename        Type      Comment  ---------        ----      -------  gongxiang        Disk       #  (shared directory on the Samba server, this shows the share name)   ipc$             IPC        IPC Service  (Samba server version 3.6.23-36.el6_8)   wang             disk      home  Directories    #wang的家目录也共享了   Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.23-36.el6_8]   server               comment     ---------            ----- --    workgroup             master    ---------             -------

6. Mount the SMB share with Wang user and access

[Email protected]_1 ~]# MKDIR/MNT/GX

[Email protected]_1 ~] #mount-o Username=wang//172.16.250.90/gongxiang/mnt/gx

[[Email protected]_1 ~] #touch 123 #touch 123 file test permissions

Similarly with mage user mount Access ibid.


This article is from the "Fall" blog, please be sure to keep this source http://lxlxlx.blog.51cto.com/3363989/1885447

Implementation of Samba shared services

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.