zoukankan      html  css  js  c++  java
  • linux服务器---安装samba

    安装samba  

    1、检测samba是否安装,如果没有,那么可以使用yum来安装。至少需要安装3个软件:samba,samba-client、samba-common

    [root@localhost pub]# rpm -qa | grep samba

    samba-winbind-clients-3.6.9-164.el6.i686

    samba-client-3.6.9-164.el6.i686

    samba-common-3.6.9-164.el6.i686

    samba4-libs-4.0.0-58.el6.rc4.i686

    samba-winbind-3.6.9-164.el6.i686

    [root@localhost pub]# yum install y samba samba-client samba-common    //如果没有,那么可以用此命令安装

    2、创建共享目录

    [root@localhost /]# mkdir /wj        //创建目录

    [root@localhost /]# chmod 777 /wj   //设置权限

    3、修改配置文件“/etc/samba/smb.cnf”

    [root@localhost /]#gedit /etc/samba/smb.conf

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

    # Scurity can be set to user, share(deprecated) or server(deprecated)

    # Backend to store user information in. New installations should 

    # use either tdbsam or ldapsam. smbpasswd is available for backwards 

    # compatibility. tdbsam requires no further configuration

        security = share           //这里默认是user,改为share,这样不用输入密码就可访问

        passdb backend = tdbsam

     

        [wj]                //创建共享目录配置

        comment=wj       //名字

        path=/wj         //路径

        read only=no    //是否只读,这里为no,这样用户就可以创建文件夹

        guest ok=yes    //是否允许guest用户登录

        browseable=yes //是否可以浏览目录

    4、修改防火墙,打开tcp的端口137、138、139、445

    [root@localhost wj]# gedit /etc/sysconfig/iptables

    -A INPUT -m state --state NEW -m tcp -p tcp --dport 137 -j ACCEPT

    -A INPUT -m state --state NEW -m tcp -p tcp --dport 138 -j ACCEPT

    -A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT

    -A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT

     

     [root@localhost wj]# service iptables restart

    iptables:将链设置为政策 ACCEPTfilter nat                [确定]

    iptables:清除防火墙规则:                                 [确定]

    iptables:正在卸载模块:                                   [确定]

    iptables:应用防火墙规则:                                 [确定]

    iptables:载入额外模块:nf_conntrack_ftp                   [确定]

    5、启动smb服务

    [root@localhost wj]# service smb start

    启动 SMB 服务:                                            [确定]

    6、测试,在终端输入命令“testparm”,可以看到共享目录的信息

    [root@localhost wj]# testparm

    Load smb config files from /etc/samba/smb.conf

    rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)

    Processing section "[homes]"

    Processing section "[printers]"

    Processing section "[wj]"

    WARNING: The security=share option is deprecated

    Loaded services file OK.

    Server role: ROLE_STANDALONE

    Press enter to see a dump of your service definitions

    [global]

        workgroup = MYGROUP

        server string = Samba Server Version %v

        security = SHARE

        log file = /var/log/samba/log.%m

        max log size = 50

        idmap config * : backend = tdb

        cups options = raw

     

    [homes]

        comment = Home Directories

        read only = No

        browseable = No

     

    [printers]

        comment = All Printers

        path = /var/spool/samba

        printable = Yes

        print ok = Yes

        browseable = No

     

    [wj]

        comment = wj            //名字

        path = /wj              //路径

        read only = No         //是否只读

        guest ok = Yes         //是否允许guest访问

     

    7、从windows测试,按下快捷键“window+r”,在弹出的窗口输入命令“smb:\192.168.0.113”,可以看到本机的共享目录

         

         

    做了一个Linux学习的平台,目前出来一个雏形,各位可以参考使用
    链接:https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ  密码:n7bk
  • 相关阅读:
    8天学通MongoDB——第一天 基础入门
    Struts2属性驱动与模型驱动
    前端传递参数,由于控制器层类实现了struts2的ModelDriven而产生的一个异常
    struts2之ModelDriven的用法
    JavaScript Array reverse 方法:颠倒数组中元素的顺序
    ibatis传入list对象
    ibatis中使用List作为传入参数的使用方法及 CDATA使用
    javascript 正则表达式判断只能是中文、英文或者中文加英文
    zclip结合easyui实现复制datagrid每行特定单元格数据的功能
    【Nodejs】使用put方式向后端查询数据并在页面显示
  • 原文地址:https://www.cnblogs.com/wj78080458/p/10036533.html
Copyright © 2011-2022 走看看