centos7 配置smb共享存儲


server0首先裝軟件 

yum install samba samba-client -y

vim /etc/samba/smb.conf

在文件末尾添加配置

[share]   #共享目錄名稱

path = /public   #共享目錄路徑

browseable = yes   #允許訪問

添加samba用戶

smbpasswd - a testuser

開啟防火牆和selinux權限后,客戶端即可訪問共享目錄。

 

desktop0安裝samba客戶端后,測試:

smbclient -L server0   #查看server0上的smb共享目錄,然后掛在遠程目錄到本地即可使用

yum -y install cifs-utils    #首先安裝文件系統cifs

mount //server0.example.com -o username=testuser,password=redhat /mnt    #手動掛載遠程目錄到本地。

 

安裝autofs實現自動掛載:

 yum -y install autofs

vim /etc/auto.master   #編輯配置文件,指定自動掛載二級配置文件路徑

/-  /etc/auto.share  #主配置文件末尾添加一行,指定使用絕對路徑、新配置文件是/etc/auto.share

cp /etc/auto.misc /etc/auto.share  #復制一份配置文件模板並編輯

vim /etc/auto.share  #添加如下內容

/mnt/share  -fstype=cifs,username=testuser,password=redhat  ://server0.example.com/share

systemctl enable autofs

systemctl restart autofs

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM