为了快速实现在 Windows 和 Debian 之间共享文件, 可以在 Debian 搭建一个 Samba 服务.
安装
sudo apt install samba
配置
以共享每个用户的用户目录为目标, 稍微修改 Samba 的配置文件即可:
diff --git a/etc/samba/smb.conf.bak b/etc/samba/smb.conf
index 970ffb8..39e75ef 100644
--- a/etc/samba/smb.conf.bak
+++ b/etc/samba/smb.conf
@@ -164,15 +164,18 @@
# public shares, not just authenticated ones
usershare allow guests = yes
+ smb1 unix extensions = no
+
#======================= Share Definitions =======================
[homes]
comment = Home Directories
- browseable = no
+ browseable = yes
+ wide links = 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共享目录可见并取消只读.
启用homes共享目录的软连接支持.
然后应用配置:
sudo systemctl daemon-reload
sudo systemctl restart smbd
添加用户
sudo smbpasswd -a $USER
快速添加当前用户为共享用户, 需要设置密码, 这个密码不是系统密码.