如何在 Debian Wheezy 中輕鬆設定 samba 共享?

如何在 Debian Wheezy 中輕鬆設定 samba 共享?

我剛剛安裝了新的 Debian Wheezy,並且正在嘗試建立新共用。我使用的是 KDE 4,在資料夾首選項選單中我找到了與 Samba 共用資料夾的選項 - 但它似乎沒有做任何事情!

Debian 中是否有 GUI 或一些基於 Web 的設定工具可用?

答案1

我不熟悉 GUI 來完成此操作,但從終端手動執行此操作的步驟還不錯。您只需執行以下操作:

安裝 Samba 和所需的軟體包

sudo apt-get install smbfs samba

編輯conf文件/etc/samba/smb.conf

確保此文件中有以下行並且未註釋它。它可能被設​​定為security = share預設值。

security = user

另外,在此文件的「共享定義」部分中,設定一個類似於以下內容的新共享:

[primary]
   comment = Guest access Share
   path = /mnt/primary
   writeable = yes
   valid users = @smb
   guest ok = no

這表示該共享將被稱為“主要”,共享目錄的本地路徑為 at /mnt/primary,授權用戶可以寫入,僅允許 smb 群組中的用戶,匿名訪客不能使用它。

測試設定testparm

完成後,儲存文件。然後運行testparm看看有沒有問題。

範例 testparm 運行

$ testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
    workgroup = MYGROUP
    server string = Samba Server Version %v
    log file = /var/log/samba/log.%m
    max log size = 50
    cups options = raw

[homes]
    comment = Home Directories
    read only = No
    browseable = No

[printers]
    comment = All Printers
    path = /var/spool/samba
    printable = Yes
    browseable = No

開始森巴舞

最後,重新啟動 samba 伺服器:

/etc/init.d/samba restart

用戶端設定(在 Windows 上)

從「我的電腦」畫面中選擇映射網路磁碟機。然後輸入:

\\debian_box_ip_address\share_name  

例如:

\\192.168.0.200\primary

然後選擇“使用不同憑證登入”並輸入您的 Linux 使用者名稱/密碼。

參考

答案2

有的是撲打(Samba Web 管理工具),可從中管理您的 Samba 伺服器。

它可以執行所選答案中的所有操作 - 減去客戶端配置 - 甚至更多。只需安裝它,然後從 Web 瀏覽器sudo apt-get install swat導航到連接埠 901 ( ) 上的伺服器。192.168.x.x:901

您需要按照 samba 要求以 root 身分登入。

相關內容