环境准备

luci-app-samba4 shadow-useradd shadow-userdel shadow-usermod

配置

注释掉 /etc/samba/smb.conf 中的 invalid users = root 以允许非 root 用户访问。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 添加用户
useradd username
# 可以屏蔽掉 bash
usermod -s /bin/false username
# 添加共享密码
smbpasswd -a username
# 修改 smb.conf 路径 /etc/samba/smb.conf
[name]
path = /path # 共享路径
valid users = username # 用户名
create mask = 0600
directory mask = 0700
read only = no
guest ok = no
vfs objects = io_uring

# 可以修改权限
chown -R username:username /path
# 重启 samba4
/etc/init.d/samba4 restart