阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

CentOS 6.5下Samba服务器搭建与配置

106次阅读
没有评论

共计 3914 个字符,预计需要花费 10 分钟才能阅读完成。

CentOS 6.5 下 Samba 服务器搭建与配置

一、samba 服务器的安装与配置

[root@localhost ~]# yum -y install samba samba-common samba-client        samba 服务器所需的软件包

[root@localhost ~]# vim /etc/samba/smb.conf                samba 服务器的主配置文件

[global]

# ———————– Network Related Options ————————-

        workgroup = MYGROUP                            工作组名称,可随便写

        server string = MY Samba Server Version %v    服务器描述,可随便写

;      netbios name = MYSERVER

;      interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24    这两条相当于 samba 服务器特有            的防火墙机制

;      hosts allow = 127. 192.168.12. 192.168.13.

# ————————— Logging Options —————————–

        log file = /var/log/samba/log.%m        samba 的日志文件及命名格式

        # max 50KB per log file, then rotate

        max log size = 50                        最大日志存储量

# ———————– Standalone Server Options ————————

        security = user            访问 samba 的用户级别(share/user/domain)

        passdb backend = tdbsam

# ————————— Printing Options —————————–

        load printers = no        是否启用打印机功能,默认为 yes

        cups options = raw

 

;      printcap name = /etc/printcap

        #obtain list of printers automatically on SystemV

;      printcap name = lpstat

;      printing = cups

# ————————— Filesystem Options —————————

[homes]                                在客户端显示的共享目录名称

        comment = homes directory      此共享目录描述

        browseable = no                不在客户端显示共享目录(即不显示 [homes])

        writable = no                  不可写

        read only=yes                  可读取

        create mode = 0664              samba 用户在自己家目录(默认 /home/sambauser)下新建                                            文件的默认权限为 0644(0 为 acl 权限)

        directory mode = 0775          samba 用户在自己家目录(默认 /home/sambauser)下新建                                                        目录的默认权限为 0775(0 为 acl 权限)

[printers]                            打印功能共享目录

        comment = All Printers

        path = /var/spool/samba

        browseable = no

        guest ok = no

        writable = no

        printable = yes

# —————————- user public options ————————-

[wxwsmb]                                服务器共享目录名称

        comment = user public directory

        path=/tmp/public                实际的共享目录绝对路径

        browseable = yes

        writable = yes

        read only= yes

        public= yes                    可以共享

        write list=@wxwsmb              可以共享此目录的 samba 用户组

[root@localhost ~]# service smb restart

关闭 SMB 服务:[确定]

启动 SMB 服务:[确定]

[root@localhost ~]# service nmb restart

关闭 NMB 服务:[确定]

启动 NMB 服务:[确定]

二、创建 samba 用户

[root@localhost ~]# groupadd wxwsmb

[root@localhost ~]# useradd -g wxwsmb smb2

[root@localhost ~]# pdbedit -a -u smb2

new password:

retype new password:

Unix username:        smb2

NT username:         

Account Flags:        [U]

User SID:            S-1-5-21-1442997883-3833565404-3457035396-1002

Primary Group SID:    S-1-5-21-1442997883-3833565404-3457035396-513

三、测试(服务器 ip 地址为 192.168.1.24)

1、linux 操作系统测试

[root@localhost ~]# smbclient -L //192.168.1.24 -U smb2

Enter smb2’s password:

Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.9-164.el6]

 

        Sharename      Type      Comment

        ———      —-      ——-

        wxwsmb          Disk      user public directory

        IPC$            IPC      IPC Service (MY Samba Server Version 3.6.9-164.el6)

        smb2            Disk      homes directory

[root@localhost ~]# mount -t cifs //192.168.1.24/smb2 /mnt -o username=smb2

Password:

[root@localhost ~]# df -h

Filesystem          Size  Used Avail Use% Mounted on

/dev/sda2            49G  5.8G  40G  13% /

tmpfs                398M    0  398M  0% /dev/shm

/dev/sda1            194M  28M  157M  15% /boot

//192.168.1.24/smb2  49G  5.8G  40G  13% /mnt

四、注意事项:

1、记得将防火墙(也可以将防火墙开启通过制定规则来使服务器与客户端通信)和 selinux 关闭;

2、共享目录开放的权限要跟目录本身的权限一致才能达到想要的你想要的效果。

————————————– 分割线 ————————————–

VMWare 虚拟机 Ubuntu 双网卡 访问 samba 速度 翻倍 http://www.linuxidc.com/Linux/2013-06/85445.htm

Samba 文件共享服务器加入 Windows Server 2003 域 http://www.linuxidc.com/Linux/2013-06/86391.htm

Samba 安装配置 http://www.linuxidc.com/Linux/2013-06/86101.htm

CentOS 6.2 下 Samba 服务的配置 http://www.linuxidc.com/Linux/2013-01/78390.htm

CentOS 6.5 系统下构建 Samba 服务器 http://www.linuxidc.com/Linux/2014-06/103196.htm

Win7+VMware+Fedora18 Samba 服务器的搭建图解 http://www.linuxidc.com/Linux/2013-01/78234.htm

————————————– 分割线 ————————————–

更多 CentOS 相关信息见 CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计3914字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中