zoukankan      html  css  js  c++  java
  • 在Centos6.5下Samba的简单配置

    本文的目的主要用来说明怎样在CentOS6.5的环境下配置出一个简单可用的samba服务,而且能够通过windows对其文件进行訪问

    安装相关软件

    # yum install samba samba-client samba-commo
    # chkconfig smb on
    # chkconfig nmb on
    

    对路由表做例如以下操作

    # iptables -I INPUT 4 -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
    # iptables -I INPUT 5 -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
    # iptables -I INPUT 6 -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
    # service iptables save

    备份配置文件

    在正式配置之前。对配置文件进行备份

    # cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
    # rm /etc/samba/smb.conf
    # touch /etc/samba/smb.conf
    # vi /etc/samba/smb.conf
    
    

    配置一个公开的文件夹

    配置一个公开的訪问文件夹,在新创建的smb.conf文件里增加以下配置
    <pre name="code" class="plain">#======================= Global Settings =====================================
    [global]
    workgroup = WORKGROUP
    security = share
    map to guest = bad user
    #============================ Share Definitions ==============================
    [MyShare]
    path = /home/samba/share
    browsable =yes
    writable = yes
    guest ok = yes
    read only = no

    设置文件夹权限,检測配置文件,重新启动服务
    # chmod -R 0777 /home/samba/share
    # testparm
    # service smb restart# service nmb restart

    
    
    
    
    
    

    配置一个受限的訪问文件夹

    增加相关的操作员以及组配置
        # useradd smbuser
        # groupadd smbgrp
        # usermod -a -G smbgrp smbuser
        # smbpasswd -a smbuser

    创建一个须要特殊用户才干訪问的文件夹
        # cd /home/samba/
        # mkdir secure
        # chown -R arbab:smbgrp secure/
        # chmod -R 0770 secure/

    在配置文件里增加以下的配置
    [Secure]
    path = /home/samba/secure
    valid users = @smbgrp
    guest ok = no
    writable = yes
    browsable = yes

    检測配置文件,重新启动服务
        # testparm
        # service smb restart
        # service nmb restart


    
    

    解决没有权限訪问的问题

    假设出现无权限訪问的问题。能够通过关闭防火墙以及selinux来尝试
     # service  iptables stop 
     # setenforce 0

    
    


  • 相关阅读:
    ThinkPad R400 windows 2008 下网卡、蓝牙驱动程序安装过程记录
    google 小百货工具
    今天发现数据库到处都有,还是学习一种比较好
    今天玩玩Android == 了解一下
    p 同学推荐的 书 读完了 == 感慨颇深,霍霍
    new confirm and new idea == need time
    娑罗双树,半枯半荣,娑罗花开,盛者必衰
    使用VC6.0 连接PostgreSQL数据库
    vc6操作PostgreSQL 测试下异步通知接口
    准备这几天看的内容
  • 原文地址:https://www.cnblogs.com/llguanli/p/8476045.html
Copyright © 2011-2022 走看看