我在 samba (linux) 中有一个共享文件夹。问题是,当我挂载共享文件夹时,即使在同一台机器上,所有文件夹和文件都显示为 root 所有,因此我只能使用 sudo 创建或修改文件。
所有文件和文件夹均显示权限为 755。
实际文件夹具有权限 777,位于 smbshare 组中并由 sambauser 所有。
我创建了 sambauser 用户,如下所述:https://computingforgeeks.com/how-to-configure-samba-share-on-debian/使用以下几行:
sudo useradd -M -s /sbin/nologin sambauser
sudo usermod -aG smbshare sambauser
这是我的配置文件:
[global]
workgroup = WORKGROUP
follow symlinks = yes
unix extensions = yes
log file = /var/log/samba/log.%m
max log size = 1000
logging = file
panic action = /usr/share/samba/panic-action %d
server role = standalone server
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
[homes]
comment = Home Directories
browseable = no
read only = yes
create mask = 0700
directory mask = 0700
valid users = %S
[docs]
comment = documents
path = /home/myuser/Documents
writable = yes
guest ok = yes
guest only = yes
force create mode = 775
force directory mode = 775
inherit permissions = yes
valid users = @smbshare
我的安装命令是:
sudo mount.smb3 //localhost/docs ~/m -o user=sambauser
我也尝试过:
sudo mount -t cifs -ouser=sambauser,vers=3.0 //localhost/docs m
我不知道我做错了什么。