无法写入来宾 cifs 分区

无法写入来宾 cifs 分区

当我尝试写入网络 CIFS 驱动器时,我始终得到

~/RetroPie/roms $ touch test
touch: cannot touch 'test': Permission denied

网络驱动器是安装在一个树莓派上的 LVM 卷,如下所示:

pi@Pi4:~$ cat /etc/fstab
/dev/mapper/mediaFiles-mediaFilesLV  /media/lvm       ext4    defaults          0        2 

有了这些权限

pi@Pi4:~$ ls -lh /media/lvm/
drwxr-xr-x  32 pi pi 4.0K Sep  4 18:26 roms

它通过 samba 与以下 /etc/samba/smb.conf 共享:

[global]
# Basic Samba configuration
server role = standalone server
passdb backend = tdbsam
;obey pam restrictions = yes
security = user
;printcap name = /dev/null
;load printers = no
;socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=524288 SO_SNDBUF=524288                                              
server string = Samba Server %v
map to guest = bad user
;dns proxy = no
;wide links = yes
;follow symlinks = yes
;unix extensions = no
;acl allow execute always = yes
log file = /var/log/samba/%m.log
max log size = 1000
log level = 2
mdns name = mdns
ea support = yes

# Special configuration for Apple's Time Machine
vfs objects = catia fruit streams_xattr
fruit:aapl = yes
fruit:model = MacSamba
fruit:encoding = native

[PiMedia]
comment = Pi4 shared folder
path = /media/lvm
read only = no
guest ok = yes
only guest = yes

然后我用 systemd 将它安装到另一个树莓派上

pi@RemotePi:~ $ cat /etc/systemd/system/home-pi-RetroPie-roms.mount 
[Unit]
Description=ROMs folder

[Mount]
What=//Pi4.local/PiMedia/roms
Where=/home/pi/RetroPie/roms
Type=cifs
Options=rw,file_mode=0777,dir_mode=0777,uid=1000,gid=1000,guest,noperm,noauto,x-systemd.automount,x-systemd.mount-timeout=30,_netdev

[Install]
WantedBy=multi-user.target

而且看起来权限没问题

pi@RemotePi:~ $ ls -lh /home/pi/RetroPie/roms/
total 0
drwxrwxrwx 2 pi pi 0 Sep  4 17:26 amstradcpc
drwxrwxrwx 2 pi pi 0 Sep  4 17:26 arcade
drwxrwxrwx 2 pi pi 0 Sep  4 17:26 atari2600
drwxrwxrwx 2 pi pi 0 Sep  4 17:26 atari5200
drwxrwxrwx 2 pi pi 0 Sep  4 17:26 atari7800
...

但是当我尝试写时

pi@RemotePi:~ $ touch RetroPie/roms/test
touch: cannot touch 'RetroPie/roms/test': Permission denied

它不会让我。

我哪里出错了?

答案1

我认为您需要定义使用哪个 Unix 用户作为来宾帐户。默认情况下这是nobody.添加到全局部分

 guest account = pi

相关内容