程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> centos 7.2 samba 搭建,centossamba

centos 7.2 samba 搭建,centossamba

編輯:C++入門知識

centos 7.2 samba 搭建,centossamba


1、下載samba源碼,上傳到centos
以samba-4.2.2 為示例
2、解壓到當前文件夾 tar xvf samba-4.2.2.tar.gz
3、編譯並默認安裝
cd samba-4.2.2
./configure
make
make install
4、配置smb.conf
安裝默認目錄在 /usr/local/samba
cp /etc/samba/smb.conf /usr/local/samba/etc/
vim /usr/local/samba/etc/smb.conf

示例配置:【homes】段改成
[root]
comment = Home Directories
path=/root
public = yes
browseable = no
writable = yes
create mask = 0777
sync always = yes
; valid users = %S
; valid users = MYDOMAIN\%S

5、運行smb
/usr/local/samba/sbin/smbd -D
/usr/local/samba/sbin/nmbd -D
可以使用 ps -ef | grep *mbd 查看是否啟動正常,否則是配置文件有誤

6、增加用戶
示例:/usr/local/samba/bin/smbpasswd -a root
輸入密碼即可

7、設置防火牆firewalld 和 selinux
一種方法是關閉防火牆
systemctl stop firewalld.service
setenforce 0
二方法是添加規則
firewall-cmd --permanent --zone=public --add-service=samba
firewall-cmd --reload

查看SELinux狀態:
1、/usr/sbin/sestatus -v ##如果SELinux status參數為enabled即為開啟狀態
SELinux status: enabled
2、getenforce ##也可以用這個命令檢查

關閉SELinux:
1、臨時關閉(不用重啟機器):
setenforce 0 ##設置SELinux 成為permissive模式
##setenforce 1 設置SELinux 成為enforcing模式
2、修改配置文件需要重啟機器:
修改/etc/selinux/config 文件
將SELINUX=enforcing改為SELINUX=disabled

8、驗證和使用samba
在windows win+r 輸入 \\$ip\root,提示輸入用戶密碼,然後正常使用,
如有問題,檢查前面步驟是否正確。

也可以映射成網絡硬盤。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved