zoukankan      html  css  js  c++  java
  • samba

    # yum install samba samba-client samba-swat
    

     安装samba完后会生成samba目录  -----> /etc/samba

    [root@centos02 ~]# ls /etc/samba/
    lmhosts  smb.conf  smbusers
    
    vi /etc/samba/smb.conf
    
    [global]
    workgroup = WORKGROUP
    

     http://blog.csdn.net/xt_xiaotian/article/details/4216408

     hosts allow = 127. 192.168.1. 192.168.2. 127.
    

     允许的IP地址段,将自己的IP地址段加入即可(注意IP的最后一段没有,但后边有个点)

    security = share  
     // 可以为如下几个(在不考虑安全的前提下,建议使用share)
    
             // share:用户不需要账户及密码即可登录samba服务器
             // user:由提供服务的samba服务器负责检查账户及密码(默认)
             // server:检查账户及密码的工作由另一台windows或samba服务器负责
             // domain:指定windows域控制服务器来验证用户的账户及密码)
    
    [share]
        path = /mnt/share 
        public = yes
    
    ;   only guest = yes
        writable = yes
    ;   printable = no
        create mode = 0777
    
        directory mode = 0777
    
    # /etc/init.d/smb restart
    
    [root@centos02 ~]# /etc/init.d/smb restart
    Shutting down SMB services:                                [  OK  ]
    Starting SMB services:                                     [  OK  ]
    
    # chmod 777 /mnt/share
    

    重启机器时,smb服务并不会自动启动

    现在让我们回到Windows

    \192.168.1.73

     结合apache 实现浏览共享里面的文件:

    # vi /etc/httpd/conf/httpd.conf
    #DocumentRoot "/var/www/html"
    DocumentRoot "/home/test #与cmb 的share为同一目录 vi /etc/samba/smb.conf--->path = /home/test/share
    <Directory "/home/test">
    
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
        Options Indexes FollowSymLinks  #这里Indexes控制是否打开目录浏览,如果要关闭目录浏览,使用Option -Indexes
    
    
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
        AllowOverride None
    
    #
    # Controls who can get stuff from this server.
    #
        Order allow,deny
        Allow from all
    
    </Directory>
    

     出现了乱码:中文支持不太好

     ------------------------------------------

    # useradd -s /sbin/nologin admin
    [root@node02 ~]# smbpasswd -a admin
    New SMB password:
    Retype new SMB password:
    Added user admin.

     SAMBA结合Apache实现直接浏览samba下的文件,以列表形式

    [root@node02 conf]# pwd
    /etc/httpd/conf
    [root@node02 conf]# vi httpd.conf
    #在httpd.conf结尾加上,下面这条语句
    AddType text/css .css 
    
    <Directory "/home/test">
    
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
        Options Indexes FollowSymLinks #你只需要将上面代码中的 Indexes 去掉,就可以禁止 Apache 显示该目录结构。用户就不会看到该目录下的文件和子目录列表了
    
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
        AllowOverride None
    
    #
    # Controls who can get stuff from this server.
    #
        Order allow,deny
        Allow from all
        Options Indexes FollowSymLinks
    </Directory>
    
  • 相关阅读:
    poj 3616 Milking Time
    poj 3176 Cow Bowling
    poj 2229 Sumsets
    poj 2385 Apple Catching
    poj 3280 Cheapest Palindrome
    hdu 1530 Maximum Clique
    hdu 1102 Constructing Roads
    codeforces 592B The Monster and the Squirrel
    CDOJ 1221 Ancient Go
    hdu 1151 Air Raid(二分图最小路径覆盖)
  • 原文地址:https://www.cnblogs.com/bass6/p/5432507.html
Copyright © 2011-2022 走看看