爱程序网

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.


 

关于爱程序网 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助