Debian 12 快速搭建 Samba 共享

为了快速实现在 WindowsDebian 之间共享文件, 可以在 Debian 搭建一个 Samba 服务.


sudo apt install samba


以共享每个用户的用户目录为目标, 稍微修改 Samba 的配置文件即可:

diff --git a/etc/samba/smb.conf.bak b/etc/samba/smb.conf
index 970ffb8..e52eb7c 100644
--- a/etc/samba/smb.conf.bak
+++ b/etc/samba/smb.conf
@@ -168,11 +168,11 @@

    comment = Home Directories
-   browseable = no
+   browseable = yes

 # By default, the home directories are exported read-only. Change the
 # next parameter to 'no' if you want to be able to write to them.
-   read only = yes
+   read only = no

 # File creation mask is set to 0700 for security reasons. If you want to
 # create files with group=rw permissions, set next parameter to 0775.

开放 homes 共享目录可见并取消只读.


sudo smbpasswd -a $USER

快速添加当前用户为共享用户, 需要设置密码, 这个密码不是系统密码.