Centos 6 之samba 搭建
学习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 搭建的更多相关文章
- Centos 基础开发环境搭建之Maven私服nexus
hmaster 安装nexus及启动方式 /usr/local/nexus-2.6.3-01/bin ./nexus status Centos 基础开发环境搭建之Maven私服nexus . 软件 ...
- 如何在Fedora或CentOS上使用Samba共享
如今,无论在家里或者是办公场所,不同的电脑之间共享文件夹已不是什么新鲜事了.在这种趋势下,现代操作系统通过网络文件系统的方式使得电脑间数据的交换变得简单而透明.如果您工作的环境中既有微软的Window ...
- CentOS 5.5 Samba服务器安装总结
centos 5.5 samba服务器安装总结先来介绍一下基本的内容windows和linux共享主要利用samba服务器,所谓SMB就是指server message block 的缩写,它是Lin ...
- CentOS 6.2下搭建Web服务器
1Centos 6.2下搭建web服务器 如今,Linux在Web应用越来越广,许多企业都采用Linux来搭建Web服务器,这样即节省了购买正版软件的费用,而且还能够提高服务器的安全性. 之前我们介绍 ...
- 在CentOS上配置SAMBA共享目录(转载)
在CentOS上配置SAMBA共享目录 From: https://blog.csdn.net/qiumei1101381170/article/details/53265341 2016年11月21 ...
- CentOS 6.3下搭建Web服务器
准备前的工作: 1.修改selinux配置文件(/etc/sysconfig/selinux) 关闭防火墙 (1)把SELINUX=enforcing注释掉 (2)并添加SELINUX=disable ...
- CentOS 7设置Samba共享目录
1. 安装Samba服务 yum -y install samba # 查看yum源中Samba版本 yum list | grep samba # 查看samba的安装情况 rpm -qa | gr ...
- 手把手教你在CentOS 7.4下搭建Zabbix监控(转)
Linux系统版本:CentOS 7.4 1.安装前需要先关闭selinux和firewall. 1.1 [root@zabbix ~]# vi /etc/selinux/config 将SELINU ...
- centos set up samba
原文中文链接:https://wiki.centos.org/zh/HowTos/SetUpSamba 原文英文链接:https://wiki.centos.org/HowTos/SetUpSamba ...
随机推荐
- Ubuntu中安装eclipse ,双击eclipse出现invalid configuration location问题
ubuntu invalid configuration location 标签: myeclipse for ubuntu ubuntu myeclipse ubuntu安装myecli ...
- tornado 协程的实现原理个人理解;
tornado实现协程的原理主要是利用了(1)python里面的generator (2)future类和ioloop相互配合,两者之间的相互配合是通过gen.coroutine装饰器来实现的: 具体 ...
- 黑马程序员——【Java高新技术】——JavaBean、注解
---------- android培训.java培训.期待与您交流! ---------- 一.JavaBean * 通过内省引入JavaBean:内省对应的英文全程是IntroSpector.在J ...
- cocos2dx常见的46中+22中动作详解
cocos2dx常见的46中+22中动作详解 分类: iOS2013-10-16 00:44 1429人阅读 评论(0) 收藏 举报 bool HelloWorld::init(){ ///// ...
- Mac下到Linux主机ssh免密码登录
最近忙得忘乎所以,写篇博客放松放松,RT,直接上命令好了 # Local ssh-keygen -t rsa scp ~/.ssh/id_rsa.pub username@server:~/.ssh/ ...
- Python 基礎 - 變量
變量 變量主要是用來存東西,是存在內存裡 Python 變量寫法: name = "Nobody One" Shell Script 變量寫法: name="Nobody ...
- cocos2d 中显示系统时间
用到的两个方法先贴上 这个是时间回调 每分钟回去调用一次时间设置方法 //定时更新状态栏上的时间 void MGameScene::update(float dt) { ; fpassedTime + ...
- RestTemplate 请求url
1.get 请求 RestTemplate restTemplate = new RestTemplate(); String url = ""; JSONObject resul ...
- 最短路径问题——dijkstra算法
仅谈谈个人对dijkstra的理解,dijkstra算法是基于邻接表实现的,用于处理单源最短路径问题(顺便再提一下,处理单源最短路径问题的还有bellman算法).开辟一个结构体,其变量为边的终点和边 ...
- bootstrap-8
基本按钮: bootstrap框架V3.x版本的基本按钮和V2.x版本的基本按钮一样,都是通过类名.btn来实现,不同的是V3.x版本要简约很多,去除V2.x版本中的大量的CSS3的部分特效. 默认按 ...