如何在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

相关推荐

  • Linux发展史

    日期:2016-10-12  Bell,MIT与GE的『Multics』系统     早期的计算机还很不普遍,除非是军事或者高科技用途,或者学术单位的学术研究,否则真的很难接触到。而且计算机架构很难使用。那个时候,程序设计者必须先将程序相关的信息在读卡纸上面打洞然后将读卡纸插入卡片阅读机来将信息读入主机中运算…

    Linux干货 2016-10-14
  • Linux磁盘与文件系统管理

    对于一块磁盘,如果我们想要使用的话,需要对磁盘进行分区并建立文件系统。下面,我们就了解一下Linux中的磁盘与文件系统管理 一、MBR 硬盘的0扇区为MBR扇区,其由以下几部分组成: l  主引导程序(偏移地址0000H–0088H),它负责从活动分区中装载,并运行系统引导程序。 l  出错信息数据区,偏移地址0089H&#8…

    Linux干货 2016-08-28
  • 马哥教育网络班22期+第十周课程练习

    1、请详细描述CentOS系统的启动流程(详细到每个过程系统做了哪些事情)    CentOS系统启动流程为:POST –> BootSequence(BIOS) –> BootLoader(MBR) –> Kernel(ramdisk) –> r…

    Linux干货 2016-12-13
  • CentOS 7上的性能监控工具

    Linux中基于命令行的性能监控工具:dstat、top、netstat、vmstat、htop、ss、glances 1、dstat – 多类型资源统计工具(需配置epel源)   该命令整合了vmstat,iostat和ifstat三种命令。同时增加了新的特性和功能可以让你能及时看到各种的资源使用情况,从而能够使你对比和整…

    Linux干货 2016-09-07
  • 计算机网络基础

    计算机网络 指使用一定的通信线路,把地理位置上相对分散的、具有独立自制能力的计算机系统等连接起来,在一定通信协议的约束与控制下,实现数据交换的目的! 计算机网络体系结构 计算机网络体系结构是一个分层次的模块式结构,每一层完成一个功能,这种流式化的结构能提高生产力!网络分层的好处 促进了标准化 各层次相互独立,技术升级和扩展灵活性好 便于方案的设计 开放系统互…

    Linux干货 2016-09-06
  • 20160801作业-用户和组

    http://note.youdao.com/yws/public/redirect/share?id=ba6a68550cd5c0ba5fd1cbfb66651916&type=false

    Linux干货 2016-08-08

评论列表(1条)

  • stanley
    stanley 2016-03-22 10:39

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