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】共享服务器的搭建和相关权限设置的更多相关文章

  1. samba服务器的搭建和用户权限,文件夹权限设置

    一.简介:samba服务是基于netbios  安装: 通过yum安装 [root@localhost ~]# yum install samba samba-client samba-swat 查看 ...

  2. 适配iOS10 的相关权限设置

    解决办法(fix method):在info.plist —Source Code中添加UsageDescription相关的key, 描述字符串自己随意填写就可以,但是一定要填写,不然会引发包无效的 ...

  3. samba共享服务器搭建 亲手实验

    一.简介 Samba是一个能让Linux系统应用Microsoft网络通讯协议的软件,而SMB是Server Message Block的缩写,即为服务器消息块 ,SMB主要是作为Microsoft的 ...

  4. 设置共享文件夹,samba和chmod到底谁的权限大

    1,必备知识.已经知道的请跳过. 首先科普一下这两个东西:samba和chmod其实是完全不同层面的东西,一个是共享服务协议,一个是权限设置语句.但是他们有一个共同的用途:可以用来实现设置一个共享文件 ...

  5. Samba共享目录的多用户权限设置案例

    下面根据实际工作中遇到的一个共享目录的多用户权限需求案例来说明下Samba用户权限的设置. 一.需求场景领导:李一(liyi)正式员工(zhengshiyuangong):刘二二(liuerer).于 ...

  6. 关于使用samba用户的权限设置

    首先要保证你的samba安装并配置好,关于安装和配置samba请参考此文章http://blog.csdn.net/linglongwunv/archive/2010/01/19/5212875.as ...

  7. 搭建MHA环境【1】规划+linux相关的设置

    [1]规划 MHA这套软件包涵两个部分 1.manager :主要负责对MySQL集群状态的检查&在master 库宕机时对故障进行转移. 2.node      :主要包涵状态检查& ...

  8. 织梦CMS搭建网站必做的服务器相关安全设置

    http://help.dedecms.com/install-use/server/2011/1109/2124.html#printSource http://www.aliweihu.com/9 ...

  9. Linux中samba服务器的搭建

    使用的vmware12虚拟机安装的centos6.8和物理机上的windows10,实现在windows10 上访问CentOs上的samba服务. 一.先查看系统中是否安装有samba服务相关的软件 ...

随机推荐

  1. 【jenkins】构建工作集

    构建工作集,参数化工作任务 1.New Item 2.配置新的工作任务 3.关联测试用例的远程仓库 4.添加任务构建后,触发发送报告信息 5.新建单个测试套件 6.添加触发轮询任务 7.关联测试集 8 ...

  2. AWT02-ContainerAPI

    1.体系 Object -Component -Container Window:窗口容器 Frame:创建窗口 Dialog:创建对话框 Panel:内嵌容器 Applet ScrollPane:含 ...

  3. 2020-2021-1 20209307《Linux内核原理与分析》第六周作业

    这个作业属于哪个课程 <2020-2021-1Linux内核原理与分析)> 这个作业要求在哪里 <2020-2021-1Linux内核原理与分析第六周作业> 这个作业的目标 & ...

  4. html 09-HTML5详解(三)

    09-HTML5详解(三) #Web 存储 随着互联网的快速发展,基于网页的应用越来越普遍,同时也变的越来越复杂,为了满足各种各样的需求,会经常性在本地存储大量的数据,传统方式我们以document. ...

  5. windows jupyter lab中.ipynb转中文PDF

    在jupyter lab中,File-Export Notebook as-Export Notebook to PDF,可以导出成PDF格式的文档,但在操作前需要安装些程序.1. 安装pandocA ...

  6. python去除文件中重复的行

    去除文件中重复的行 import os with open('db.txt','r',encoding='utf-8') as read_f,\ open('.db.txt.swap','w',enc ...

  7. TP学习—第一天:框架的简单学习;创建应用;

    一.框架目录文件的介绍     common  核心函数库目录 conf   框架的核心配置文件 lang   语言包目录 library   核心资源库目录 tpl 不用管,就是几个模板  Thin ...

  8. SSRF深入学习

    爆出来的直接关于SSRF的漏洞有俩,①是weblogic,②是discuzz SSRF漏洞最主要的部分并不是SSRF 探测内网,而是可以写shell,反弹shell,虽然很多厂家把它归为低危漏洞,仔细 ...

  9. Docker实例开机启动

    部署项目服务器时,为了应对停电等情况影响正常web项目的访问,会把Docker容器设置为开机自动启动. 在使用docker run启动容器时,使用--restart参数来设置: docker run ...

  10. 利用设计模式消除业务代码中的 if-else

    准备工作:假设这样的一个业务场景:有一个自动开票的功能需要实现,在程序里面需要根据账单的类型执行对应的处理逻辑. 以下使用了 Lombok 简化代码!!! 账单类型枚举: /** * @author ...