如何在CentOS 6上安装配置Samba

Samba主要用于windows与Linux之间的文件共享,使用SMB/CIFS协议。CentOS 6默认安装不包括samba软件包,所以需要我们手动进行安装。

Step 1 >> 安装samba

[root@localhost ~]# yum install samba -y

Step 2 >> 创建一个共享用户名和密码

[root@localhost ~]# useradd shareuser -s /sbin/nologin

                现在创建samba密码用户shareuser使用smbpasswd命令

[root@localhost ~]# smbpasswd -a shareuser
      New SMB password:
      Retype new SMB password:
      Added user shareuser.

Step 3 >> 创建一个名为共享的文件夹的根目录

[root@localhost ~]# mkdir /share

                并且更改共享文件夹的所有权

[root@localhost /]# chown -R shareuser:root /share/

Step 4 >> 添加配置信息

[root@localhost /]# vim /etc/samba/smb.conf

                在文件末行添加如下,保存退出。

[share]
      comment = Share
      path = /share
      writable = yes
      valid users = shareuser

Step 5 >> 启动samba服务

[root@localhost /]# service smb start
      Starting SMB services:                                     [  OK  ]

                系统引导时自动启动samba服务

[root@localhost /]# chkconfig –levels 235 smb on

Step 6 >> 检查配置,使用 testparm

[root@localhost /]# testparm
      Load smb config files from /etc/samba/smb.conf
      rlimit_max: increasing rlimit_max (1024) to minimum   Windows limit (16384)
      Processing section "[homes]"
      Processing section "[printers]"
      Processing section "[share]"
      Loaded services file OK.
      Server role: ROLE_STANDALONE
      Press enter to see a dump of your service definitions

      [global]
      workgroup = MYGROUP
      server string = Samba Server Version %v
      log file = /var/log/samba/log.%m
      max log size = 50
      idmap config * : backend = tdb
     cups options = raw

     [homes]
     comment = Home Directories
     read only = No
     browseable = No

     [printers]
     comment = All Printers
     path = /var/spool/samba
     printable = Yes
     print ok = Yes
     browseable = No

    [share]                                            #看这
    comment = Share
    path = /share
    valid users = shareuser
    read only = No

Step 7 >> 关闭防火墙

[root@localhost /]# chkconfig –level 35 iptables off    #永久性关闭

[root@localhost /]# /etc/init.d/iptables stop                #普通关闭
      iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
      iptables: Flushing firewall rules:                                  [  OK  ]
      iptables: Unloading modules:                                     [  OK  ]

Step 8 >> 关闭selinux

[root@localhost /]# vim /etc/selinux/config

                 编辑config文件,找到SELINUX行修改为:SELINUX=disable

[root@localhost ~]# cat /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

Step 9 >> 重启系统

最后补上成果图

123.png

223.png

原创文章,作者:黑白子,如若转载,请注明出处:http://www.178linux.com/13126

(1)
黑白子黑白子
上一篇 2016-03-21 20:48
下一篇 2016-03-22 10:41

相关推荐

  • 网络服务之Apache

      互联网这个历史已经不算很短了,它大大方便了人类获取信息,开阔了人类的眼界,使得让这个世界变得小了起来,人与人之间的距离感也不会存在了,娱乐也更加丰富,听音乐、看电影等等这一系列,都能从网上进行,这些功能,都是由www服务器来提供服务,在Linux中,提供网络的服务器有很多种,那么今天我们就讲一个比较老牌,且依然能存活的服务器“阿帕奇”…

    Linux干货 2017-01-13
  • 二、(1)Linux常用文件管理类命令详解

    Linux 文件管理 命令 cp mv rm

    2018-01-08
  • 管理用户和组。

    用户的概念        对于计算机的应用,我们大多数都是在储存资料、办公娱乐。我们耗费精力与时间把我们喜欢的一些东西寻找下载在我们的计算机中,这台计算机没有一丁点限制,谁都可以进行访问,那我们所进行存储的一些东西就将变得很不安全,但是我们在给计算机创建一个用户并设置密码之后,其他人没获得…

    Linux干货 2016-10-23
  • OpenSSL

    一、什么是OpenSSL 在电脑网络上,OpenSSL是一个开放源代码的软件库包,应用程序可以使用这个包来进行安全通讯,避免窃听,同时确认另一端连接者的身份。这个包广泛被应用在互联网的网页服务器上。其主要库是以C语言所写成,实现了基本的加密功能,实现了SSL与TLS协议。 OpenSSL由三部分组成:     libencryp…

    Linux干货 2016-04-25
  • week4

    一,复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其他用户均没 有任何访问权限; cp -r /etc/skel/ /home/tuser1 chmod -R go= /home/tuser1/ 二,编辑/etc/group文件,添加组hado…

    Linux干货 2016-11-18
  • 用户 组 和权限 以及权限的 分类

    关于文件的安全我们要从3A验证 说起     1  Authentication:认证      2  Authorization:授权      3  Accouting|Audition:审计 由于系统文件的用户太多为了便于管理 我们便把系统的用…

    系统运维 2016-08-04

评论列表(1条)

  • stanley
    stanley 2016-03-22 10:39

    写的不错。关于samba可以再从介绍些