搜尋此網誌

Samba 架設


Samba Server 在安裝時需要安裝兩個套件

1. samba

2. samba-common


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

[root@instructor~]#yum -y install samba-common

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

以=====Share Definitions====區分,以上為global斷,以下為設定變數斷

74行的地方有個 workgoup = MYGROUP  <--此行為設定工作群組名稱

80行的hosts allow = <---限制可連samba server 的網段或主機,即是白名單的意思

接下來就可以看最下面的部分了

設定檔內有提供範例

 

[share]  <---client連線時所輸入的目錄
 #comment = Public Stuff 
path = /home/samba  <---開放存取的路徑
publis = yes                 <----開放匿名存取
#writable = yes             <-----可寫
#printable = no
#write list = +staff

publis = yesmkdir /home/samba

[root@instructor~]#ll -dlZ /var/lib/samba  (查詢本來samba分享路徑的安全脈絡)

[root@instructor~]#semanage fcontext -a -t samba_var_t '/home/samba(/.*)?'\

[root@instructor~]#restorecon -Rv /home/samba

[root@instructor~]#service smb start; chkconfig smb on

Client 端的部分需要安裝samba-client的套件

 

[root@vserver~]#smbclient -N //[Samba主機IP]/share

 這樣就可以匿名存去Samba的服務了

如果上頭設定檔 publis = yes 改成上註解或是no的話就是關閉匿名存取的服務

Samba Server的主機就必須創建Samba的使用者帳號

[root@instructor~]#smbpasswd -a student

[root@instructor~]#pdbedit -wL  (這個指令可以看現在有哪些samba使用者帳號)

[root@vserver~]#smbclient -U student%student //[Samba主機IP]/share

如果要針對student開放寫的權限,除了writable = yes這個變數要打開外

還要針對目錄做acl

[root@instructor~]#setfacl -m u:student:rwx /home/samba



Samba 自動掛載 [Client]

 




 

Copyright © Jackie.Chen | Powered by Blogger | Template by 54BLOGGER | Fixed by Free Blogger Templates