码迷,mamicode.com
首页 > 其他好文 > 详细

部署Samba共享服务器

时间:2016-06-24 16:19:53      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:服务器   账号   

  1. 建立组账户tech、创建员工账号jiashenzhen    chenlongfei
    [root@localhost ~]# groupadd tech

    [root@localhost ~]# useradd -g tech chenlongfei
    [root@localhost ~]# useradd -g tech jiashenzhen
    [root@localhost ~]# useradd common

    2.创建存放共享资源的文件夹/home/samba/data,以及子目录public tech jiashenzhen  chenlongfei
    [root@localhost share]# mkdir public tech jiashenzhen  chenlongfei
    [root@localhost share]# chown root:tech public
    [root@localhost share]# chown root:tech tech
    [root@localhost share]# chown jiashenzhen:root jiashenzhen
    [root@localhost share]# chown chenlongfei:root chenlongfei
    [root@localhost share]# chmod -R 700 jiashenzhen
    [root@localhost share]# chmod -R 700 chenlongfei
    [root@localhost share]# chmod -R 775 public
    [root@localhost share]# chmod -R 770 tech



    3.创建共享用户
    useradd common
    pdbedit -a -u common
    useradd jiashenzhen
    pdbedit -a -u jiashenzhen
    useradd chenlongfei
    pdbedit -a -u chenlongfei
    useradd root
    pdbedit -a -u root

    [root@localhost share]# pdbedit -L(验证账户)
    jiashenzhen:501:
    root:0:root
    chenlongfei:502:
    common:503:



    4.修改smb.conf文件,添加共享设置,并启动smb服务
    [root@localhost share]# vi /etc/samba/smb.conf

    [global]
        
        workgroup = MYGROUP
        server string = Samba Server Version %v
        config file = /etc/samba/smb.conf.%U
        
        
        
        
        log file = /var/log/samba/log.%m
        max log size = 50
        

        security = user
        passdb backend = tdbsam



        
        load printers = yes
        cups options = raw


        
    [homes]
        comment = Home Directories
        path = /home/samba/data/home
        browseable = yes
        writable = yes
            write list = root,@tech

    [public]
        comment = public
        path = /home/samba/data/public
        browseable = yes
        writable = yes
        valid users = root,@tech,common
        write list = root,@tech
        directory mask = 774
            create mask =  775
        
        
    [tech]
        comment = technology data
        path = /home/samba/data/tech
        browseable = yes
        guest ok = no
        writable = no
        valid users = root,@tech
        write list = root,@tech
        directory mask = 0774
            create mask =  0660
    [Jiashenzhen]
        comment = chenlongfei data
        path = /home/samba/data/jiashenzhen
        browseable = no
        guest ok = no
        writable = no
        valid users = jiashenzhen
        write list = jiashenzhen
        directory mask = 0700
            create mask =  0700
    [chenlongfei]
        comment = chenlongfei data
        path = /home/samba/data/chenlongfei
        browseable = no
        guest ok = no
        writable = no
        valid users = chenlongfei
        write list = chenlongfei
        directory mask = 0700
            create mask =  0700



    子配置文件
    [root@rd samba]# egrep -v "^;|#" smb.conf.jiashenzhen
        
    [global]
        
        workgroup = MYGROUP
        server string = Samba Server Version %v
        
        
        
        
        log file = /var/log/samba/log.%m
        max log size = 50
        

        security = user
        passdb backend = tdbsam

        
        load printers = yes
        cups options = raw

        
    [public]
        comment = Home Directories
        path = /home/samba/data/public
        browseable = yes
        writable = yes
        valid users = root,@tech
        write list = root,@tech
        directory mask = 0774
            create mask =  0660
        
        
    [tech]
        comment = technology data
        path = /home/samba/data/tech
        browseable = yes
        guest ok = no
        writable = no
        valid users = root,@tech
        write list = root,@tech
        directory mask = 0774
        create mask =  0660

    [Jiashenzhen]
        comment = jiashenzhen data
        path = /home/samba/data/jiashenzhen
        guest ok = no
        writable = no
        valid users = jiashenzhen
            write list = jiashenzhen
            directory mask = 0700
            create mask =  0700





    [root@rd samba]# egrep -v "^;|#" smb.conf.chenlongfei


    [global]
        
        workgroup = MYGROUP
        server string = Samba Server Version %v
        
        
        
        
        log file = /var/log/samba/log.%m
        max log size = 50
        

        security = user
        passdb backend = tdbsam


        
        load printers = yes
        cups options = raw


        
    [homes]
        comment = Home Directories
        path = /home/samba/data/home
        browseable = yes
        writable = yes
            write list = root,@tech

    [public]
        comment = public
        path = /home/samba/data/public
        browseable = yes
        writable = yes
        valid users = root,@tech
        write list = root,@tech
        directory mask = 0774
            create mask =  0660
        
        
    [tech]
        comment = technology data
        path = /home/samba/data/tech
        browseable = yes
        guest ok = no
        writable = no
        valid users = root,@tech
        write list = root,@tech
        directory mask = 0774
            create mask =  0660
    [chenlongfei]
        comment = chenlongfei data
        path = /home/samba/data/chenlongfei
        guest ok = no
        writable = no
        valid users = chenlongfei
        write list = chenlongfei
        directory mask = 0700
            create mask =  0700

        





    启动服务
    /etc/init.d/smb start
    /etc/init.d/nmb start





    客户端访问:
    smbclient //172.23.145.41/tech -U jiashenzhen

    客户端挂载:

     mount -t cifs //172.23.145.41/tech /home/172.23.145.41 -o username=jiashenzhen,password=jiashenzhen






本文出自 “jiazheming” 博客,请务必保留此出处http://8888866666.blog.51cto.com/6988153/1792530

部署Samba共享服务器

标签:服务器   账号   

原文地址:http://8888866666.blog.51cto.com/6988153/1792530

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!