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. sqli-labs less-24(二次注入)

    less-24 原理: 在网站处理用户提交的数据的时候,只是将某些敏感字符进行了转义.因而使得用户第一次提交的时候不会被当做代码执行.但是这些数据存入数据库的时候却没有转义,而网站程序默认数据库中的数 ...

  2. DirectX12的初始化

    DirectX12的初始化主要分为以下若干步骤: 创建device和gifactory 创建与GPU通信同步相关的objects,command和fence 创建swap chain 为render ...

  3. Angular *ngIf length

    Angular *ngIf length 在Angular中如何判断*ngIf Arrary的长度? 具体代码如下: result = []; <div class="kt-secti ...

  4. 图解 IP 基础知识!

    我把自己以往的文章汇总成为了 Github ,欢迎各位大佬 star https://github.com/crisxuan/bestJavaer IP 协议 路由器对分组进行转发后,就会把数据包传到 ...

  5. 图解HTTP权威指南 | HTTP报文

                                                                                    一.问题 1.报文流是如何流动的 2.H ...

  6. Python进阶——为什么GIL让多线程变得如此鸡肋?

    本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,如有问题请及时联系我们以作处理 做 Python 开发时,想必你肯定听过 GIL,它经常被 Python 程序员吐槽,说 Pytho ...

  7. HTTP Error 405.0 - Method Not Allowed 无法显示您正在查找的页面,因为使用了无效方法(HTTP 谓词)。

    将submit改成button即可   因为触发了form表单

  8. python列表(九)元组

    元组 元组是不可变序列,元组一旦创建,用任何方法都不可以修改其元素. 元组的偶有元素是放在一对圆括号"()"中 1.元组创建与删除 使用"="讲一个元组赋值给变 ...

  9. eclipse再见,android studio 新手入门教程(一)基本设置

    写在前面: 作为一个刚半只脚踏入android开发的新手,在使用eclipse开发了两个自我感觉不甚成熟的商城类app之后,遇到了一些问题,总结为如下: 代码复用性.findviewById,oncl ...

  10. [LeetCode]652. Find Duplicate Subtrees找到重复树

    核心思想是:序列化树 序列化后,用String可以唯一的代表一棵树,其实就是前序遍历改造一下(空节点用符号表示): 一边序列化,一边用哈希表记录有没有重复的,如果有就添加,注意不能重复添加. 重点就是 ...