標籤:mask sea localhost 指定 windows selinux 位置 hub creat
安裝:
dnf install samba
設定:
官方預設配置:https://github.com/samba-team/samba/blob/master/examples/smb.conf.default
設定檔預設在/etc/samba/smb.conf裡,我的配置是這樣的:
[global] workgroup = WORKGROUP security = user log file = /var/log/samba/%m.log passdb backend = tdbsam hosts allow = [虛擬網段的ip,可以在宿主機裡ipconfig看一下] 127.0.0.1 localhost printing = cups printcap name = cups load printers = yes cups options = raw
[project] comment = Project path = /home/osyo/projects browseable = yes writable = yes valid users = osyo create mask=0770 Force create mode=0770
最後一個[preject]是我自己的共用folder設定,關於檔案夾使用權限設定說明:http://linuxcommand.org/lts0070.php
這裡簡單說下我設定的755 -rwxr-x-r-x (檔案擁有者可以讀寫執行,其他成員只能讀和執行)
r:讀,w:寫,x:執行,-(除第一個):佔位
-表示0,例r-x = 101 = 5
三個rwx的位置依次是:檔案擁有者、其所在使用者組的成員、其他使用者
防火牆開放連接埠:
smb用到的連接埠:tcp:139/445 udp:137/138,系統預設用的是firewall
https://fedoraproject.org/wiki/FirewallD/zh-cn#.E4.BD.BF.E7.94.A8_firewall-cmd
firewall-cmd --permanent --add-port=139/tcp
firewall-cmd --permanent --add-port=137/udp
...
重啟firewall,查看當前啟用的資訊
firewall-cmd --list-all
添加samba使用者:
smbpasswd -a [username]
note:username必須為系統中已存在的使用者,建立linux使用者參考:https://docs.fedoraproject.org/en-US/Fedora/12/html/Deployment_Guide/s2-users-add.html
啟動samba:
systemctl start smb
確認是否可以串連:
smbclient -L //host/[shareFolder]
宿主機Windows中串連:
在檔案總管中右鍵此電腦->添加一個網路位置,指定網站的位置:\\[虛擬機器ip]\[sharefile]
設定靜態ip:
出於對之後windows建立串連方便,固定下ip地址。因為用的GUI,直接參照動態擷取到的IP就好了...
ISSUES:
1、在windows下訪問檔案提示沒有許可權
檢查eslinux是否允許共用的檔案夾開放,可以關掉:
http://www.apelearn.com/study_v2/chapter16.html#id3
或者設定eslinux:
https://fedoraproject.org/wiki/SELinux/samba
參考:
http://cn.linux.vbird.org/linux_server/0370samba.php#server_share
http://www.linuxidc.com/Linux/2011-03/33636.htm
Samba配置 - Fedora虛擬硬碟掛載到宿主Windows