且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Apache的访问NTFS文件夹挂在linux

更新时间:2023-09-25 22:11:16

我不能提供一个100%的工作解决方案,但我有,你可能要检查两分。

首先,尝试添加的umask 的fstab 行。我认为这会导致权限错误。 的umask 添加正确权限的所有文件(644)和目录进行安装时(755)。 您必须重新安装的NTFS文件夹!

  UUID = XXDDXDDXDDDXDDDD /媒体/ MYNAME /拉布勒NTFS用户EXEC,UID = www数据,GID = www数据和umask = 022 0 2

您需要确保,在 www数据用户能够 CD 到目标文件夹:

  sudo的苏www数据-s庆典和放大器;&安培; CD /媒体/ MYNAME /拉布勒

第二,确保有FollowSymLinks只可在特定的文件夹,我觉得你有那了,但尝试反正:

 <目录/媒体/ MYNAME /拉布勒/>
    有FollowSymLinks +指数
    设置AllowOverride无
    为了允许,拒绝
    所有允许
< /目录>
<目录的/ var / www的>
    有FollowSymLinks +指数
    设置AllowOverride无
    为了允许,拒绝
    所有允许
< /目录>

Using Apache2/PHP in Debian jessie, when I want to make a new subsection in document folder of Apache (/var/www) I simply create a link to an external folder where my php files exist and simply change the owner and permissions of the folder as follow and it works perfect.

ln -s /home/myname/mynewcode /var/www/test1
chown -R www-data:www-data /home/myname/mynewcode
chmod -R 755 /home/myname/mynewcode

Then I could access http://localhost/test1

But when the real folder that I want to link it, is on a NTFS partition since chown and chmod do not work, I do modify the /etc/fstab by adding the following code, therefore my NTFS partitions will mount with the required permissions and owner.

UUID=XXDDXDDXDDDXDDDD /media/myname/lable ntfs user,exec,uid=www-data,gid=www-data 0 2

ln -s /media/myname/lable/mynewcode2 /var/www/test2

But still I do get the permission error from Apache2 and I don't know what to do!!

Forbidden
You don't have permission to access /test2 on this server.
Apache/2.4.10 (Debian) Server at localhost Port 80

I cannot offer a 100% working solution but I have two points which you might want to check.

First, try adding umask to the fstab line. I think this causes the permission error. umask adds correct permission to all files (644) and directories (755) when mounting. You must remount the NTFS folder!

UUID=XXDDXDDXDDDXDDDD /media/myname/lable ntfs user,exec,uid=www-data,gid=www-data,umask=022 0 2

You need to make sure, the www-data user is able to cd into the destination folder:

sudo su www-data -s bash && cd /media/myname/lable

Second, make sure "FollowSymlinks" is allowed on the specific folder, I think you have that already, but try anyways:

<Directory "/media/myname/lable/">
    Options FollowSymLinks +Indexes
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<Directory "/var/www">
    Options FollowSymLinks +Indexes
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>