使用samba建立共享存儲示例

環境:CentOS 6.8

###安裝samba程序包
[root@nod1 ~]#yum install samba -y
    
#給samba增加授權用戶,新增的samba用戶必須是系統中已經存在的用戶
####################################
    [root@nod1 ~]# smbpasswd -a gentoo
    New SMB password:
    Retype new SMB password:
    Added user gentoo.
    [root@nod1 ~]# smbpasswd -a centos
    New SMB password:
    Retype new SMB password:
    Added user centos.
    [root@nod1 ~]# smbpasswd -a ubuntu
    New SMB password:
    Retype new SMB password:
    Added user ubuntu.
    
#編輯配置文件
#######################################
    [root@nod1 ~]# vim /etc/samba/smb.conf
    [global]
    workgroup = MYGROUP
    server string = Samba Server Version %v
    security = user
    passdb backend = tdbsam
    load printers = yes
    cups options = raw
           hosts allow = 172.16.0.          #host白名單
    [shared]                                 #共享名
    comment = my samba
    path = /data                             #共享的本地目錄
    public = no
    valid users = gentoo,centos,ubuntu       #允許訪問的用戶       
    read list = ubuntu                       #讀權限的用戶
    write list = centos,gentoo              #讀寫權限的用戶
    writable = yes
    printable = no 
#啓動服務 
#########################################
    [root@nod1 ~]# service nmb start
    啓動 NMB 服務:                                            [確定]
    [root@nod1 ~]# service smb start
    啓動 SMB 服務:                                            [確定]
##連接samba共享存儲:
    smbclient //172.16.100.5/shared -U centos


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章