欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

搭建 CentOS 6 服务器(10) - Samba

程序员文章站 2022-06-12 16:57:56
...
(1)安装
# yum -y install samba
    Installed:
      samba.i686 0:3.6.9-169.el6_5
# pdbedit -a rensn
    new password:123456
    retype new password:123456
    ……


(2)Home文件夹
# mkdir /etc/skel/samba
# mkdir /home/rensn/samba
# chown rensn:rensn /home/rensn/samba


(3)共享文件夹
# mkdir /home/samba
# chown nobody:nobody /home/samba


(4)设置
# cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
# vi /etc/samba/smb.conf
    [global]
       unix charset = UTF-8     # <= Linux编码
       dos charset = CP932      # <= Windows编码
       display charset = UTF-8  # <= Linux编码
       smb ports = 139            # <= 端口

       workgroup = FUGA         # <= Windows的Workgroup名

       hosts allow = 127. 192.168.21.  # <= 只允许本地网路访问

       load printers = no     # <= 不允许共享打印机
       disable spoolss = yes  

       printing = bsd 
    [homes]
       comment = Home Directories
       path = %H/samba     # <= home文件夹路径/home/<user>/samba
       browseable = no
       writable = yes
    [public] 
       comment = Public Stuff
       path = /home/samba
       public = yes
       writable = yes
       only guest = yes


(5)启动服务
# /etc/rc.d/init.d/smb start
# /etc/rc.d/init.d/nmb start


(6)确认
从Windows系统访问后新建文件后
# ll  /home/rensn/samba


(7)SWAT

安装
# yum -y install samba-swat


设置
# vi /etc/xinetd.d/swat
    service swat
    {
        port            = 901
        socket_type     = stream
        wait            = no
        only_from       = 127.0.0.1 192.168.21.0/24
        user            = root
        server          = /usr/sbin/swat
        log_on_failure  += USERID
        disable         = yes
    }


确认
通过浏览器访问:https://<youripaddress>:901/