【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服务相关的软件 ...
随机推荐
- python 通过pip freeze、dowload打离线包及自动安装【适用于保密的离线环境】
python的pip是其包管理工具,相当方便好用.本文只介绍pip 如何通过其freeze命令打离线包,及其离线包的安装脚本.这个知识点,特别适用于不适合连通互联网,设备需要物理隔绝,保密要求严格的客 ...
- 【ubantu下安装python3.6】
Ubuntu16.04默认安装了Python2.7和3.5 请注意,系统自带的python千万不能卸载! 输入命令python
- gnuplot名词缩写
http://blog.163.com/yucheng_xiao/blog/static/7660019220141017114630822/ with 缩写成 w lt 是 linetype 的缩 ...
- gitlab+jenkins 持续部署自动化测试
背景:为了减少测试部署时间和减少不必要的重复工作,采用持续集成的方式进行部署,当gitlab的release (测试)分支有代码变动时,自动拉取代码部署测试环境,并进行接口回归测试 优点:部署自动化, ...
- 找和为K的两个元素
总时间限制:1000ms 内存限制: 65536kB 描述 在一个长度为n(n < 1000)的整数序列中,判断是否存在某两个元素之和为k. 输入 第一行输入序列的长度n和k,用空格分开. 第二 ...
- spark踩坑--WARN ProcfsMetricsGetter: Exception when trying to compute pagesize的最全解法
spark踩坑--WARN ProcfsMetricsGetter: Exception when trying to compute pagesize的最全解法 问题描述 大概是今年上半年的时候装了 ...
- 老哥你能写篇 SpringCloud Alibaba 全家桶吗? 看视频太累 太枯燥了 !
最喜欢的一句话: 1.01的365次方=37.78343433289 >>>1 0.99的365次方= 0.02551796445229, 每天进步一点点的目标,贵在坚持 前端时间有 ...
- SpringBoot从入门到精通教程(六)
之前学了,这么多东西 thyemeaf .MyBatis 还有 配置文件等等,今天我们就来做一个小案例 CRUD,程序员的必备 项目结构 pom.xml <!-- mybatis 相关依赖 -- ...
- 为什么Python多线程无法利用多核
1.全局解释锁 如题: Python的多线程为什么不能利用多核处理器? 全局解释器锁(Global Interpreter Lock)是计算机程序设计语言解释器用于同步线程的一种机制,它使得任何时刻仅 ...
- 解决[BScroll warn]: Can not resolve the wrapper DOM. Vue better-scroll
在开发项目过程中,使用better-scroll插件中遇到了滚动一次重复提示相同错误 [BScroll warn]: Can not resolve the wrapper DOM. Vue bett ...