Samba配置 - Fedora虛擬硬碟掛載到宿主Windows

來源:互聯網
上載者:User

標籤: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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.