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
  • 相关阅读:
    Android H5混合开发(5):封装Cordova View, 让Fragment、弹框、Activity自由使用Cordova
    机器学习 AI 谷歌ML Kit 与苹果Core ML
    Android 设备唯一标识(多种实现方案)
    Android自定义控件:图形报表的实现(折线图、曲线图、动态曲线图)(View与SurfaceView分别实现图表控件)
    Android 禁止截屏、录屏 — 解决PopupWindow无法禁止录屏问题
    Android原生PDF功能实现:PDF阅读、PDF页面跳转、PDF手势伸缩、PDF目录树、PDF预览缩略图
    某助手验证码通信交互包分析
    IOS弓箭传说的插件开发
    微店APP协议简要分析
    Owhat sign参数分析
  • 原文地址:https://www.cnblogs.com/wj78080458/p/10036533.html
Copyright © 2011-2022 走看看