www-data 访问 sshfs 挂载点

Ang*_*chs 2 linux debian mount sshfs apache-2.2

我有Apache2一个Debian Linux. 我将 a 挂载sshfs到目录/mnt/mountpoint/(它在启动时通过 挂载/etc/fstab)。它通过来自 的软链接访问/var/www/mountpoint

当我使用浏览器访问该目录时,出现 403。

正如我所见,用户www-data无法读取目录。

输出lswww-data

d????????? ? ?    ?       ?            ? mountpoint
Run Code Online (Sandbox Code Playgroud)

输出lsroot

drwxrwxrwx 1 aneuschitzer www-data 4.0K Jun  5 16:27 
Run Code Online (Sandbox Code Playgroud)

我对应的行 /etc/fstab

sshfs#reader@targethost:/mnt/mountpoint  /mnt/mountpoint        fuse    ro,noexec,gid=www-data  0 0
Run Code Online (Sandbox Code Playgroud)

首先我有选择ro,noexec,我试过没有noexec。我已阅读如何设置 sshfs 以使用 www-data并尝试添加 gid,但没有帮助。

Mic*_*ton 8

您需要启用选项allow_other和/或user_allow_other/etc/fuse.conf. 否则只有挂载文件系统的用户才能使用它。完成更改后,卸载并重新挂载文件系统。