学习linux从实践做起。

实验环境:vmware,cenots 6,xshell

注意:使用vmware 时,网络连接设置成桥接,和宿主机位于同一个网段。

实验需求:模拟实际公司文件服务器。 新建SHARE 文件夹,权限所有人公开

新建IT 文件夹,只对IT部门员工开放

新建DE文件夹,对于DE部门员工开放

实验步骤:

1:由于selinux设置不懂,和iptables 只了解皮毛,为了不必要的麻烦:

关闭selinux :

 [root@localhost ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

关闭iptables:

 [root@localhost ~]# service iptables stop;chkconfig iptables off;chkconfig --list | grep iptables
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables :off :off :off :off :off :off :off

2:reboot,查看并且确保生效

 [root@localhost ~]# reboot
之后,继续查看
[root@localhost ~]# chkconfig --list | grep iptables
iptables :off :off :off :off :off :off :off

3:新建SHARE,IT,DE文件夹并设置权限

 [root@localhost ~]# mkdir -m  /home/SHARE /home/IT /home/DE
[root@localhost ~]# ls -l /home/
total
drwxrwx---. root root Dec : DE
drwxrwx---. root root Dec : IT
drwxrwx---. root root Dec : SHARE

4:新建用户组SHARE,IT,DE,新建IT1,IT2用户,新建DE1,DE2用户(IT1,IT2,DE1,DE2属于SHARE组,IT1,IT2属于IT组,DE1,DE2属于IT组)

 [root@localhost ~]#  groupadd SHARE;groupadd IT;groupadd DE
[root@localhost ~]# cat /etc/group
...
SHARE:x::
IT:x::
DE:x::
[root@localhost ~]# useradd IT1;usermod -s /sbin/nologin IT1 ;gpasswd -a IT1 IT; useradd IT2;usermod-s /sbin/nologin IT2 ;gpasswd -a IT2 IT; useradd DE1;usermod  -s /sbin/nologin DE1 ;gpasswd -a DE1 DE;useradd DE2 ;usermod -s /sbin/nologin DE2 ;gpasswd -a DE2 DE; gpasswd -a IT1 SHARE ;gpasswd -a IT2 SHARE;gpasswd -a DE1 SHARE; gpasswd -a DE2 SHARE

[root@localhost ~]# cat /etc/group
...
public:x::IT1,IT2,DE1,DE2
IT:x::IT1,IT2
DE:x::DE1,DE2
IT1:x::
IT2:x::
DE1:x::
DE2:x::

5:安装samba

 [root@localhost ~]# yum -y install samba samba-client samba-swat
 [root@localhost ~]# rpm -qa | grep samba
samba-winbind-clients-3.6.-.el6_7.x86_64
samba-swat-3.6.-.el6_7.x86_64
samba-client-3.6.-.el6_7.x86_64
samba-3.6.-.el6_7.x86_64
samba-winbind-3.6.-.el6_7.x86_64
samba-common-3.6.-.el6_7.x86_64

6:备份smb.conf

 [root@localhost ~]# cp  /etc/samba/smb.conf /etc/samba/smb.conf.bk

7:将用户账户添加到samba账户

 [root@localhost ~]# smbpasswd -a IT1
New SMB password:
Retype new SMB password:
Added user IT1.
[root@localhost ~]# smbpasswd -a IT2
New SMB password:
Retype new SMB password:
Added user IT2.
[root@localhost ~]# smbpasswd -a DE1
New SMB password:
Retype new SMB password:
Added user DE1.
[root@localhost ~]# smbpasswd -a DE2
New SMB password:
Retype new SMB password:
Added user DE2.

查看samba服务中,注册了哪些用户

 [root@localhost ~]# pdbedit -L
IT1::
DE1::
IT2::
DE2::

8:修改smb.conf配置文件

   [SHARE]
comment = share
path = /home/SHARE
valid users = @SHARE
read only = No
create mask =
directory mask = [IT]
comment = IT
path = /home/IT
valid users = @IT
read only = No
create mask = [DE]
comment = DE
path = /home/DE
valid users = @DE
read only = No
create mask =
directory mask =

9:重启samba服务:

 [root@supker ~]# service smb restart
Shutting down SMB services: [ OK ]
Starting SMB services: [ OK ]
[root@supker ~]# service nmb restart
Shutting down NMB services: [ OK ]
Starting NMB services: [ OK ]

《此处,请允许我感慨一声,真是日了狗了,测试半天,都是没有权限新建文件,然而reboot一下,就可以了!》

10:测试结果展示:

提示:断开共享盘连接的windows CMD命令:net use  * /del /y

Centos 6 之samba 搭建的更多相关文章

  1. Centos 基础开发环境搭建之Maven私服nexus

    hmaster 安装nexus及启动方式 /usr/local/nexus-2.6.3-01/bin ./nexus status Centos 基础开发环境搭建之Maven私服nexus . 软件  ...

  2. 如何在Fedora或CentOS上使用Samba共享

    如今,无论在家里或者是办公场所,不同的电脑之间共享文件夹已不是什么新鲜事了.在这种趋势下,现代操作系统通过网络文件系统的方式使得电脑间数据的交换变得简单而透明.如果您工作的环境中既有微软的Window ...

  3. CentOS 5.5 Samba服务器安装总结

    centos 5.5 samba服务器安装总结先来介绍一下基本的内容windows和linux共享主要利用samba服务器,所谓SMB就是指server message block 的缩写,它是Lin ...

  4. CentOS 6.2下搭建Web服务器

    1Centos 6.2下搭建web服务器 如今,Linux在Web应用越来越广,许多企业都采用Linux来搭建Web服务器,这样即节省了购买正版软件的费用,而且还能够提高服务器的安全性. 之前我们介绍 ...

  5. 在CentOS上配置SAMBA共享目录(转载)

    在CentOS上配置SAMBA共享目录 From: https://blog.csdn.net/qiumei1101381170/article/details/53265341 2016年11月21 ...

  6. CentOS 6.3下搭建Web服务器

    准备前的工作: 1.修改selinux配置文件(/etc/sysconfig/selinux) 关闭防火墙 (1)把SELINUX=enforcing注释掉 (2)并添加SELINUX=disable ...

  7. CentOS 7设置Samba共享目录

    1. 安装Samba服务 yum -y install samba # 查看yum源中Samba版本 yum list | grep samba # 查看samba的安装情况 rpm -qa | gr ...

  8. 手把手教你在CentOS 7.4下搭建Zabbix监控(转)

    Linux系统版本:CentOS 7.4 1.安装前需要先关闭selinux和firewall. 1.1 [root@zabbix ~]# vi /etc/selinux/config 将SELINU ...

  9. centos set up samba

    原文中文链接:https://wiki.centos.org/zh/HowTos/SetUpSamba 原文英文链接:https://wiki.centos.org/HowTos/SetUpSamba ...

随机推荐

  1. oracle 解锁表

    //查询锁表id select session_id from v$locked_object; //查询该ID的serial# SELECT sid, serial#, username, osus ...

  2. 【winform 学习】登录

    一直都是做asp.net,没有做过winform项目,新建个项目后,就啥不会了,不知道从何下手. 简单的登录项目也不会,画了个登录界面后,就遇到了,跳入主界面后,怎样将登录界面关闭的问题. 在网上找到 ...

  3. 或许是 Nginx 上配置 HTTP2 最实在的教程了

    导读 从 2015 年 5 月 14 日 HTTP/2 协议正式版的发布到现在已经快有一年了,越来越多的网站部署了 HTTP2,HTTP2 的广泛应用带来了更好的浏览体验,只要是 Modern 浏览器 ...

  4. Thrift 个人实战--初次体验Thrift

    前言: Thrift作为Facebook开源的RPC框架, 通过IDL中间语言, 并借助代码生成引擎生成各种主流语言的rpc框架服务端/客户端代码. 不过Thrift的实现, 简单使用离实际生产环境还 ...

  5. 神奇的盒模型(BFC)

    上一篇我提到每一个元素都有自己的display属性,其属性值可以改变.其改变的方式,可以利用神奇的css盒模型(BFC). 盒模型,是css可视化格式化系统的基础,可以用于元素定位和网页布局.一个盒模 ...

  6. 【转载】基于ANSYS APDL的有裂纹平板问题的断裂力学仿真(PLANE183)

    原文地址:http://blog.sina.com.cn/s/blog_9e19c10b0102vnw7.html 对于一般的强度问题,我们总是用应力来度量其强度的.但是对于有裂纹的,高强度的构件,使 ...

  7. ATMEL处理器自带USB CDC的Win7驱动问题

    [背景] 很久以前使用ATMEL的处理器开发了一款设备,通过处理器本身的功能,借助USB在PC端虚拟一个串口出来,实现和上位机软件的通信,和基本的参数设置和数据读取功能. 这个功能就是ATMEL官网上 ...

  8. 《Visual C++并行编程实战》译者序

    说来凑巧,当开始着手这本书的翻译时,我刚刚入手了自己第一台四核计算机,而翻译工作临近完成之时,我又为自己添置了一台iPad 2(这是一台双核计算机).由此可见,多核计算机已经完全进入了我的日常生活.鉴 ...

  9. bll编译错误

    如果在项目中 ,bll有函数,却引用报错 原因很可能是因为bll在生成程序集的时候,没有生成好.其中有错误 解决办法. 1.将bll,web,dal重新生成 2.注意bll的生成,该添加的添加,该排除 ...

  10. Openstack Neutron OVS ARP Responder

    ARP – Why do we need it? In any environment, be it the physical data-center, your home, or a virtual ...