码迷,mamicode.com
首页 > 其他好文 > 详细

centos安装配置samba文件服务器

时间:2014-09-24 19:05:37      阅读:229      评论:0      收藏:0      [点我收藏+]

标签:samba服务器   防火墙   centos   

一、要求:

1、公司有两个部门,美术部和运营部。

2、有三个文件夹分别是meishu、yunying和public

3、public包括meishu和yunying

4、美术部对meishu和public/meishu可读可写,对yunying文件夹没有权限打开,对public/yunying可读;

5、运营部对yunying和public/yunying可读可写,对meishu文件夹没有权限打开,对public/meishu可读;


二、开启防火墙samba相应端口或者直接关闭防火墙,这里直接关闭。

#/etc/init.d/iptables stop

在/etc/selinux下的config里面设置SELINUX=disabled


三、安装samba

1、#yum -y install samba samba-client samba-swat

有依赖关系的包samba-common、samba-winbind-clients、libsmbclient将自动安装上去。

启动samba: 

#/etc/init.d/smb start

#/etc/init.d/nmb start


2、设置开机启动

#chkconfig --add smb

#chkconfig --add nmb

#chkconfig smb on

#chkconfig nmb on


四、配置samba

配置文件是/etc/samba/smb.conf


1、新建相关用户和用户组

#useradd -s /sbin/nologin msadmin

#useradd -g msadmin -s /sbin/nologin maomao

#useradd -s /sbin/nologin yyadmin

#useradd -g yyadmin -s /sbin/nologin zyq

#useradd -s /sbin/nologin admin 

2、设置用户密码

#smbpasswd -a msadmin (其他类似)

3、建立相应文件夹

#mkdir -p /home/{meishu,yunying,public}

#mkdir -p /home/public/{meishu,yunying}

4、设置文件夹权限

#cd /home

#chown msadmin.msadmin meishu

#chown yyadmin.yyadmin yunying

#chown admin.admin public

#cd /home/public

#chown msadmin.msadmin meishu && chown yyadmin.yyadmin yunying

#chmod 1775 meishu yunying (这步很重要,要实现各部门人员对其有可写权限)


5、smb.conf配置如下:

#======================= Global Settings =====================================


[global]


# ----------------------- Network Related Options -------------------------

#

# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH

#

# server string is the equivalent of the NT Description field

#

# netbios name can be used to specify a server name not tied to the hostname


        workgroup = WORKGROUP

        server string = shyy Samba Server Version %v

        netbios name = ShyySamba


# --------------------------- Logging Options -----------------------------

#

# Log File let you specify where to put logs and how to split them up.


        log file = /var/log/samba/log.%m

        max log size = 50


# ----------------------- Standalone Server Options ------------------------

#

# Scurity can be set to user, share(deprecated) or server(deprecated)


        security = user

        passdb backend = tdbsam


#============================ Share Definitions ==============================


[meishu]

     comment = This is a directory of meishu.

     path = /home/meishu

     public = no

     admin users = msadmin

     valid users = @msadmin

#     writable = yes

     write list = @msadmin

     create mask = 0750

     directory mask = 0750


[yunying]

     comment = This is a directory of yunyhing.

     path = /home/yunying

     public = no

     admin users = yyadmin

     valid users = @yyadmin

 #    writable = yes

     write list = @yyadmin

     create mask = 0750

     directory mask = 0750


[renshi]

     comment = This is a directory of renshi.

     path = /shyygame/renshi

     public = no

     admin users = hradmin

     valid users = @hradmin

  #   writable = yes

     write list = @hradmin

     create mask = 0750

     directory mask = 0750



[public]

     comment = This is a share directory.

     path = /home/public

     public = no

     valid users = admin,@hradmin,@msadmin,@yyadmin

     write list = @msadmin,@yyadmin,@hradmin

   #  writable = yes

     create mask = 0750

     directory mask = 0750

测试配置命令:#testparm

五、登录

1、linux客户端连接共享服务器

#smbclient //ip/public

2、windows客户端连接共享服务器

在地址栏中输入 \\ip或者在网上邻居中找到共享的机器双击,之后要求输入账密。



centos安装配置samba文件服务器

标签:samba服务器   防火墙   centos   

原文地址:http://8490919.blog.51cto.com/8480919/1557829

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!