如何在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.www58058.com/13126

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

相關推薦

  • 一起學DHCP系列(三)理解、APIPA

    原創作品,允許轉載,轉載時請務必以超鏈接形式標明文章 原始出處 、作者信息和本聲明。否則將追究法律責任。http://jeffyyko.blog.51cto.com/28563/162407      這是《一起學DHCP》系列的第三節。      …

    Linux干貨 2015-03-25
  • 編譯安裝httpd-2.4.9及新特性詳解

    前言 前面我們講解了httpd在CentOS6上(httpd-2.2)的相關功能配置,而CentOS7上采用了httpd-2.4的版本,那么httpd-2.4增加了哪些特性呢?接下來讓我們在CentOS6.6上手動編譯安裝一下httpd-2.4.9,看一下和httpd-2.2有什么不同,順便補充說一下httpd的其它功能。 環境及新特性介紹 環境介紹 系統環…

    Linux干貨 2015-04-15
  • 第一周作業

    作業

    Linux干貨 2018-03-20
  • raid 5 軟件實現

    raid 5        RAID 5是一種存儲性能、數據安全和存儲成本兼顧的存儲解決方案。 RAID 5可以理解為是RAID 0和RAID 1的折中方案。RAID 5可以為系統提供數據安全保障,但保障程度要比Mirror低而磁盤空間利用率要比Mirror高。RAID 5具有和RAID 0相近似的…

    2017-05-02
  • 文件權限

    普通文件 r: 可以讀取文件的內容 w: 可以修改文件的內容 x: 可以執行該文件 執行腳本(不要隨便給文件加x權限) 目錄文件 r: 用戶可以列出目錄下有哪些文件(不能查看文件的詳細信息) w: 只有w無意義。 x: 用戶可以進入該目錄(如果知道文件名,且有相對應的文件權限 ,可以執行對應的操作) 權限一般配合使用,不同權限配合有不同效果 rx: 用戶可以…

    2017-07-30
  • 數學集合–德摩根定律

    初中數學學過集合的概念: ~表示補集 ∩表示交集 ∪表示并集 ∈表示屬于 !表示取反 條件: x屬于C集合中之外的部分:~C 證明:   ∵x∈~C    x屬于集合c的補集     x∈~(A∩B)    想屬于a和b…

    Linux干貨 2016-08-15

評論列表(1條)

  • stanley
    stanley 2016-03-22 10:39

    寫的不錯。關于samba可以再從介紹些

欧美性久久久久