1. 程式人生 > >Manjaro 配置Samba 共享資料夾給Windows 訪問

Manjaro 配置Samba 共享資料夾給Windows 訪問

Windows 中VMWare 安裝的虛擬機器Ubuntu 裡面使用Samba 共享資料夾十分方便,基本上就是在資料夾上右鍵選擇共享就可以了(可能會提示安裝軟體)。而換到Manjaro 後右鍵屬性中並沒有此選項,本文記錄一下如何在Manjaro 下配置Samba 共享資料夾給windows 系統。

安裝軟體

sudo pacman -S samba gvfs-smb thunar-shares-plugin

thunar-shares-plugin 可以thunar-shares-plugin-manjaro代替,我這邊是因為換了軟體源,前一個軟體找不到才換的。

Manjaro 配置

安裝 manjaro-settings-samba

,安裝這個軟體後會自動做一些配置:

sudo pacman -S manjaro-settings-samba

重點來了,怎麼編寫/etc/samba/smb.conf 配置檔案。下面是一個例子,前面的部分都是自動生成的,最後一塊是新增的。

[global]
   workgroup = WORKGROUP
   dns proxy = no
   log file = /var/log/samba/%m.log
   max log size = 1000
   client max protocol = NT1
   server role = standalone server
   passdb backend =
tdbsam obey pam restrictions = yes unix password sync = yes passwd program = /usr/bin/passwd %u passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n *passwd:*all*authentication*tokens*updated*successfully* pam password change = yes map to guest = Bad Password usershare allow guests =
yes name resolve order = lmhosts bcast host wins security = user guest account = nobody usershare path = /var/lib/samba/usershare usershare max shares = 100 usershare owner only = yes force create mode = 0070 force directory mode = 0070 [homes] comment = Home Directories browseable = no read only = yes create mask = 0700 directory mask = 0700 valid users = %S [printers] comment = All Printers browseable = no path = /var/spool/samba printable = yes guest ok = no read only = yes create mask = 0700 [print$] comment = Printer Drivers path = /var/lib/samba/printers browseable = yes read only = yes guest ok = no [m_sharee] comment = MShare Directories path = /home/{username}/m_share browseable = yes read only = no create mask = 0700 directory mask = 0700

read only 屬性設定為no 是為了有寫入檔案許可權

新增分享使用者並設定密碼

gpasswd sambashare -a username
smbpasswd -a username

啟用smaba 服務

systemctl enable smb nmb
systemctl start smb nmb

之後再做修改後你可能需要Log out 再Log in

Windows 設定

開啟資源管理器,計算機,選擇“對映網路驅動器”,輸入在Manjaro 的ip 地址(ip addr show),形如“\\192.168.137.12*”

參考