CentOS 6.5下samba伺服器搭建與配置

來源:互聯網
上載者:User

標籤:centos 6.5下samba伺服器搭建與配置

一、samba伺服器的安裝與配置

[[email protected] ~]# yum -y install samba samba-common samba-client        samba伺服器所需的軟體包

[[email protected] ~]# vim /etc/samba/smb.conf                samba伺服器的主設定檔

[global]

# ----------------------- Network Related Options -------------------------

        workgroup = MYGROUP                            工作群組名稱,可隨便寫

        server string = MY Samba Server Version %v     伺服器描述,可隨便寫

;       netbios name = MYSERVER

;       interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24    這兩條相當於samba伺服器特有            的防火牆機制 

;       hosts allow = 127. 192.168.12. 192.168.13.

# --------------------------- Logging Options -----------------------------

        log file = /var/log/samba/log.%m         samba的記錄檔及命名格式

        # max 50KB per log file, then rotate

        max log size = 50                        最大日誌儲存量

# ----------------------- Standalone Server Options ------------------------

        security = user            訪問samba的使用者層級(share/user/domain)

        passdb backend = tdbsam

# --------------------------- Printing Options -----------------------------

        load printers = no         是否啟用印表機功能,預設為yes

        cups options = raw


;       printcap name = /etc/printcap

        #obtain list of printers automatically on SystemV

;       printcap name = lpstat

;       printing = cups

# --------------------------- Filesystem Options ---------------------------

[homes]                                 在用戶端顯示的共用目錄名稱

        comment = homes directory       此共用目錄描述

        browseable = no                 不在用戶端顯示共用目錄(即不顯示[homes])

        writable = no                   不可寫

        read only=yes                   可讀取

        create mode = 0664              samba使用者在自己家目錄(預設/home/sambauser)下建立                                            檔案的預設許可權為0644(0為acl許可權)

        directory mode = 0775           samba使用者在自己家目錄(預設/home/sambauser)下建立                                                        目錄的預設許可權為0775(0為acl許可權)

[printers]                            列印功能共用目錄

        comment = All Printers

        path = /var/spool/samba

        browseable = no

        guest ok = no

        writable = no

        printable = yes

# ---------------------------- user public options -------------------------

[wxwsmb]                                伺服器共用目錄名稱

        comment = user public directory

        path=/tmp/public                實際的共用目錄絕對路徑

        browseable = yes

        writable = yes

        read only= yes

        public= yes                     可以共用

        write [email protected]              可以共用此目錄的samba使用者組

[[email protected] ~]# service smb restart

關閉 SMB 服務:                                            [確定]

啟動 SMB 服務:                                            [確定]

[[email protected] ~]# service nmb restart 

關閉 NMB 服務:                                            [確定]

啟動 NMB 服務:                                            [確定]

二、建立samba使用者

[[email protected] ~]# groupadd wxwsmb

[[email protected] ~]# useradd -g wxwsmb smb2

[[email protected] ~]# pdbedit -a -u smb2

new password:

retype new password:

Unix username:        smb2

NT username:          

Account Flags:        [U          ]

User SID:             S-1-5-21-1442997883-3833565404-3457035396-1002

Primary Group SID:    S-1-5-21-1442997883-3833565404-3457035396-513

三、測試(伺服器ip地址為192.168.1.24)

1、linux作業系統測試

[[email protected] ~]# smbclient -L //192.168.1.24 -U smb2

Enter smb2‘s password: 

Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.9-164.el6]


        Sharename       Type      Comment

        ---------       ----      -------

        wxwsmb          Disk      user public directory

        IPC$            IPC       IPC Service (MY Samba Server Version 3.6.9-164.el6)

        smb2            Disk      homes directory

[[email protected] ~]# mount -t cifs //192.168.1.24/smb2 /mnt -o username=smb2

Password: 

[[email protected] ~]# df -h

Filesystem           Size  Used Avail Use% Mounted on

/dev/sda2             49G  5.8G   40G  13% /

tmpfs                398M     0  398M   0% /dev/shm

/dev/sda1            194M   28M  157M  15% /boot

//192.168.1.24/smb2   49G  5.8G   40G  13% /mnt

四、注意事項:

1、記得將防火牆(也可以將防火牆開啟通過制定規則來使伺服器與用戶端通訊)和selinux關閉;

2、共用目錄開放的許可權要跟目錄本身的許可權一致才能達到想要的你想要的效果。

本文出自 “資源共用” 部落格,請務必保留此出處http://www1991.blog.51cto.com/8692352/1564663

CentOS 6.5下samba伺服器搭建與配置

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.