【Samba】共享服务器的搭建和相关权限设置
1.查看防护墙
[root@zhang~ ]# /etc/init.d/iptables status
iptables:Firewall is not running.
如果没有关闭的话将他规则清空并关闭
iptables–F
iptables–L
/etc/init.d/iptablessave
/etc/ini.d/iptablesstop
chkconfigiptables off
关闭后再次查看状态
2.查看selinux
[root@zhang~]# sestatus
SELinuxstatus: disabled
如果没有关闭的话手动将他关闭,并重新启动服务器
3.查看软件安装状态
[root@zhang~]# rpm -qa | grep samba
samba-winbind-3.6.23-44.el6_9.x86_64
samba-client-3.6.23-44.el6_9.x86_64
samba4-libs-4.2.10-6.el6_7.x86_64
samba-common-3.6.23-44.el6_9.x86_64
samba-winbind-clients-3.6.23-44.el6_9.x86_64
4.查看需要装的安装包
[root@zhang~]# yum grouplist | grep file
Repositorybase is listed more than once in the configuration
Repositoryupdates is listed more than once in the configuration
Repositoryextras is listed more than once in the configuration
Repositorycentosplus is listed more than once in the configuration
Repositorycontrib is listed more than once in the configuration
Loadingmirror speeds from cached hostfile
CIFS file server
NFSfile server
Network file system client
[root@zhang~]# yum groupinfo 'CIFS file server'
Loadedplugins: fastestmirror, refresh-packagekit, security
Settingup Group Process
Repositorybase is listed more than once in the configuration
Repositoryupdates is listed more than once in the configuration
Repositoryextras is listed more than once in the configuration
Repositorycentosplus is listed more than once in the configuration
Repositorycontrib is listed more than once in the configuration
Loadingmirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.sohu.com
Group:CIFS file server
Description: Share files between Linux andMicrosoft Windows systems.
Mandatory Packages:
samba
Optional Packages:
tdb-tools
安装需要的包:
[root@zhang~]# yum groupinstall 'CIFS file server' –y
再次查看已经安装的samba的安装包
[root@zhang~]# rpm -qa | grep samba
samba-winbind-3.6.23-44.el6_9.x86_64
samba-client-3.6.23-44.el6_9.x86_64
samba4-libs-4.2.10-6.el6_7.x86_64
samba-common-3.6.23-44.el6_9.x86_64
samba-winbind-clients-3.6.23-44.el6_9.x86_64
samba-3.6.23-44.el6_9.x86_64
二、编写配置文件
1.配置文件所在路径是
[root@zhangsamba]# ls
lmhosts smb.conf smbusers
[root@zhangsamba]# pwd
/etc/samba
2.备份配置文件
[root@zhangsamba]#cp smb.conf smb.conf.bak
[root@zhangsamba]# ls
lmhosts smb.conf smb.conf.bak smbusers
3.将配置追加到配置文件末尾
[zhang]
path=/shared/zhang --指定共享文件的路径 --
writable = yes --用来指定该共享路径是否可写
create mask = 1444
directory mask = 1555 --create和directory这两个权限可以控制文件可以下载上传,但是无法删除和修改
附录中有完整的smb.conf文件的配置信息
4.创建需要的文件
[root@zhangsamba]#mkdir /shared/zhang/
5.修改文件的权限
[root@zhang samba]# chmod a+w /shared -R
6.启动服务
[root@zhangsamba]# service smb start
[root@zhangsamba]# service nmb start
[root@zhangsamba]# chkconfig smb on
[root@zhangsamba]# chkconfig nmb on
7.查看端口
[root@zhangsamba]# netstat -lntup | grep mbd
8.将系统用户装换为samba的用户
[root@zhangsamba]#useradd samba --这个用户随便名称都可以
[root@zhangsamba]# smbpasswd-a samba --“-a”后面跟的用户是新创建的用户
NewSMB password: admin
Retypenew SMB password:admin
上面输入的密码是windows登录共享文件服务器的时候需要的密码
三、windows访问共享文件服务器
这里的ip是192.168.1.118
这里的账号密码就是新创建的用户和smb的密码
我这里是用户:samba 密码是:admin
这样就可以进入了
可以进行上传文件和读取文件的内容,但是无法进行修改保存,更无法删除
测试:
创建了一个txt文件,内容如下:
将其上传到共享文件中
打开是没有问题的
修改后:
但是修改后保存会提示:
这是修改后覆盖源文件的报错
这是想要重新命名的报错
会创建相应的文件,但是文件是没有任何内容的空文件
想要删除的话:
需要联系管理员从文件服务器中删除
附录1:
sam的配置文件smb.conf的全部内容
[root@vm123 samba]# more smb.conf
[global]
workgroup = LQ1507
server string = AYYK Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
#nt pipe support = no
security = share
load printers = yes
cups options = raw
netbios name = LQ1507FilesServer
hosts allow = 127. 192.168.1. 192.168.6. 10.10.1. 10.0.0.
[homes]
comment = Home Directories
browseable = no
writable = no
[share]
path = /shared/share
public = yes
guest ok = yes
#browseable = no
#writable = yes
read only = no
[tools]
path = /shared/tools
public = yes
guest ok = yes
writable = yes
read only = no
guset ok = yes
[开发]
path=/shared/研发中心
writable = yes
create mask = 1444
directory mask = 1555
guest ok = yes
附录2:
#1.全局部分参数设置:
[global]
#与主机名相关的设置
workgroup = zkhouse <==工作组名称
netbios name = zkserver <==主机名称,跟hostname不是一个概念,在同一个组中,netbios name必须唯一
serverstring = this is a test samba server <==说明性文字,内容无关紧要
#与登录文件有关的设置
log file = /var/log/samba/log.%m <==日志文件的存储文件名,%m代表的是client端Internet主机名,就是hostname
max log size = 50 <==日志文件最大的大小为50Kb
#与密码相关的设置
security= share <==表示不需要密码,可设置的值为share、user和server
passdb backend = tdbsam
#打印机加载方式
load printer = no <==不加载打印机
-----------------------------------------------------------
#2.共享资源设置方面:将旧的注释掉,加入新的
#先取消[homes]、[printers]的项目,添加[temp]项目如下
[temp] <==共享资源名称
comment = Temporary file space <==简单的解释,内容无关紧要
path = /tmp <==实际的共享目录
writable = yes <==设置为可写入
browseable = yes <==可以被所有用户浏览到资源名称,
guest ok= yes <==可以让用户随意登录
【Samba】共享服务器的搭建和相关权限设置的更多相关文章
- samba服务器的搭建和用户权限,文件夹权限设置
一.简介:samba服务是基于netbios 安装: 通过yum安装 [root@localhost ~]# yum install samba samba-client samba-swat 查看 ...
- 适配iOS10 的相关权限设置
解决办法(fix method):在info.plist —Source Code中添加UsageDescription相关的key, 描述字符串自己随意填写就可以,但是一定要填写,不然会引发包无效的 ...
- samba共享服务器搭建 亲手实验
一.简介 Samba是一个能让Linux系统应用Microsoft网络通讯协议的软件,而SMB是Server Message Block的缩写,即为服务器消息块 ,SMB主要是作为Microsoft的 ...
- 设置共享文件夹,samba和chmod到底谁的权限大
1,必备知识.已经知道的请跳过. 首先科普一下这两个东西:samba和chmod其实是完全不同层面的东西,一个是共享服务协议,一个是权限设置语句.但是他们有一个共同的用途:可以用来实现设置一个共享文件 ...
- Samba共享目录的多用户权限设置案例
下面根据实际工作中遇到的一个共享目录的多用户权限需求案例来说明下Samba用户权限的设置. 一.需求场景领导:李一(liyi)正式员工(zhengshiyuangong):刘二二(liuerer).于 ...
- 关于使用samba用户的权限设置
首先要保证你的samba安装并配置好,关于安装和配置samba请参考此文章http://blog.csdn.net/linglongwunv/archive/2010/01/19/5212875.as ...
- 搭建MHA环境【1】规划+linux相关的设置
[1]规划 MHA这套软件包涵两个部分 1.manager :主要负责对MySQL集群状态的检查&在master 库宕机时对故障进行转移. 2.node :主要包涵状态检查& ...
- 织梦CMS搭建网站必做的服务器相关安全设置
http://help.dedecms.com/install-use/server/2011/1109/2124.html#printSource http://www.aliweihu.com/9 ...
- Linux中samba服务器的搭建
使用的vmware12虚拟机安装的centos6.8和物理机上的windows10,实现在windows10 上访问CentOs上的samba服务. 一.先查看系统中是否安装有samba服务相关的软件 ...
随机推荐
- WPS PDF转Word工具
WPS PDF转Word工具链接:https://pan.baidu.com/s/1Ijh5MSBWZtsXsm05_6yYvw 提取码:gufy 下载运行后会解压到"D:\Program ...
- 在RAC上部署OGG并配置OGG高可用
目录 简介 环境信息 安装OGG 配置数据库 开启数据库级别日志补充 在dbdc1为OGG单独创建TNS 创建OGG管理用户及其表空间 配置OGG 设置OGG全局参数 Source端,OGG设置, 配 ...
- mysql主从同步错误
一.主从同步报错 mysql> show slave status\G; *************************** 1. row ************************* ...
- SpringBoot + Layui +Mybatis-plus实现简单后台管理系统(内置安全过滤器)
1. 简介 layui(谐音:类UI)是一款采用自身模块规范编写的前端UI框架,遵循原生HTML/CSS/JS的书写与组织形式,门槛极低,拿来即用.其外在极简,却又不失饱满的内在,体积轻盈,组件丰 ...
- Django使用channels实现Websocket连接
简述: 需求:消息实时推送消息以及通知功能,采用django-channels来实现websocket进行实时通讯.并使用docker.daphne启动通道,保持websocket后台运行 介绍Dja ...
- PHPCMS V9.6.0 SQL注入漏洞分析
0x01 此SQL注入漏洞与metinfo v6.2.0版本以下SQL盲注漏洞个人认为较为相似.且较为有趣,故在此分析并附上exp. 0x02 首先复现漏洞,环境为: PHP:5.4.45 + Apa ...
- 响应式网站设计---Bootstrap
响应式布局可以帮助我们实现网站布局随屏幕大小自动调整的需求,实现不同屏幕分辨率的终端上浏览网页的不同展示方式,使得网页在PC端和手机端均可以完美的展现其内容,具有自适应性. 使用基于Bootstrap ...
- Azure Service Bus(二)在NET Core 控制台中如何操作 Service Bus Queue
一,引言 上一篇讲到关于 Azure ServiceBus 的一些概念,讲到 Azure Service Bus(服务总线),其实也叫 "云消息服务",是微软在Azure 上提供的 ...
- openstack高可用集群21-生产环境高可用openstack集群部署记录
第一篇 集群概述 keepalived + haproxy +Rabbitmq集群+MariaDB Galera高可用集群 部署openstack时使用单个控制节点是非常危险的,这样就意味着单个节 ...
- Python机器学习课程:线性回归算法
本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,如有问题请及时联系我们以作处理 最基本的机器学习算法必须是具有单个变量的线性回归算法.如今,可用的高级机器学习算法,库和技术如此之多 ...