「Samba」:修訂間差異

出自Gea-Suan Lin's Wiki
跳至導覽 跳至搜尋
本頁面具有訪問限制。如果您看見此訊息,這代表您沒有訪問本頁面的權限。
(创建页面,内容为“'''Samba'''是一個提供SMB協定的軟體。 == 安裝 == 大多數的Linux套件都有提供,在Ubuntu下可以用apt安裝: <syntaxhighlight lang="bash"> sudo apt install -y samba; sudo apt clean </syntaxhighlight> == 外部連結 == * {{Official|https://www.samba.org/}} {{en}} Category:軟體”)
 
 
(未顯示同一使用者於中間所作的 9 次修訂)
行 8: 行 8:
sudo apt install -y samba; sudo apt clean
sudo apt install -y samba; sudo apt clean
</syntaxhighlight>
</syntaxhighlight>
== 設定 ==
設定會在<code>/etc/samba/smb.conf</code>,建議將原來檔案先備份到<code>/etc/samba/smb.conf.bak</code>:
<syntaxhighlight lang="ini">
#
[global]
   guest account = nobody
   map to guest = Bad User
   passdb backend = tdbsam
   security = user
   server string = File server
   workgroup = WORKGROUP
[shared]
   browseable = yes
   create mask = 0644
   directory mask = 0755
   force user = nobody
   path = /data/samba-shared
   public = yes
   writable = yes
</syntaxhighlight>
接著建立nobody對應的Samba帳號:
<syntaxhighlight lang="bash">
sudo smbpasswd -a -n nobody
</syntaxhighlight>
然後重新啟動:
<syntaxhighlight lang="bash">
sudo service smbd restart
</syntaxhighlight>
=== 防火牆 ===
使用[[UFW]]:
<syntaxhighlight lang="bash">
sudo ufw allow from 192.168.0.0/16 to any app Samba
</syntaxhighlight>
== 其他 ==
新版的[[Windows]]在client端會阻擋使用guest當入Samba,會需要透過gpedit修改允許:
* https://superuser.com/a/1438512


== 外部連結 ==
== 外部連結 ==

於 2024年3月8日 (五) 09:54 的最新修訂

Samba是一個提供SMB協定的軟體。

安裝

大多數的Linux套件都有提供,在Ubuntu下可以用apt安裝:

sudo apt install -y samba; sudo apt clean

設定

設定會在/etc/samba/smb.conf,建議將原來檔案先備份到/etc/samba/smb.conf.bak

#
[global]
    guest account = nobody
    map to guest = Bad User
    passdb backend = tdbsam
    security = user
    server string = File server
    workgroup = WORKGROUP

[shared]
    browseable = yes
    create mask = 0644
    directory mask = 0755
    force user = nobody
    path = /data/samba-shared
    public = yes
    writable = yes

接著建立nobody對應的Samba帳號:

sudo smbpasswd -a -n nobody

然後重新啟動:

sudo service smbd restart

防火牆

使用UFW

sudo ufw allow from 192.168.0.0/16 to any app Samba

其他

新版的Windows在client端會阻擋使用guest當入Samba,會需要透過gpedit修改允許:

外部連結