Apache 2 - Following a symlink to a folder on NTFS

qdada

Expert Member
Joined
Nov 19, 2003
Messages
1,412
I dual boot between Ubuntu 13.04 and Windows 7

On Ubuntu I installed LAMP just to play around. I get '403 - Forbidden' when trying to access a symlink to a folder on the NTFS partition.

I have googled a few forums on Ubuntu forums, can't get it right.

Is this at all possible ?

I saw reference to setting rights upon mounting the ntfs but it is not quite clear.
Has anyone got this right ?
 

battletoad

Expert Member
Joined
Mar 10, 2009
Messages
1,445
The issue is definitely permissions.

I take it your permissions are 600 on your files, i.e -rw-------. So say if your username is user, only user can read or modify your files. As such, the user www-data, which reads files so your webserver can display them, cannot access those files.

Just to show you that symlinking can work:
1. Go to /media with
Code:
cd /media
and note where your windows partition is loaded. I'll assume its loaded at /media/windows (its usually a hexadecimal string)
2. Unmount the partition
Code:
sudo umount /media/windows
3. The windows directory will now disappear. Remake the directory, and load windows into it.
Code:
sudo mkdir /media/winmount
sudo mount /dev/sda2 /media/winmount
assuming that your windows partition is listed as /dev/sda2. If your configuration differs, have a look at "disk utility" in the Dash, then locate your windows ntfs partition.
4. After successfully loading the partition, run the command ls -l in terminal. You will now see that the user root has ownership, and all files have 777 permissions, i.e. -rwxrwxrwx. This means that everyone, including www-data, can read your windows files.
5. Symlink the directory on your windows partition which has the html into /var/www, or whichever directory your webserver runs off.

Keep in mind, this is for demonstrative purposes only. After thats done, unmount your windows partition as its loaded as a security risk. Then pop back and we'll help you load your windows partition on startup with proper permissions setup for www-data by editing your /etc/fstab file.
 
Last edited:

Nod

Executive Member
Joined
Jul 22, 2005
Messages
9,861
Do you have this?
Code:
<Directory /usr/local/httpd/htdocs>
Options Indexes [B]FollowSymLinks[/B]
</Directory>
 

qdada

Expert Member
Joined
Nov 19, 2003
Messages
1,412
@Nod, indeed I do.
@battletoad, i shall do as you have advised and I will report back here.

Thanks for the responses.
 

qdada

Expert Member
Joined
Nov 19, 2003
Messages
1,412
@Nod, indeed I do.
@battletoad, i shall do as you have advised and I will report back here.

Thanks for the responses.
 

qdada

Expert Member
Joined
Nov 19, 2003
Messages
1,412
it worked, me ntfs partition was mount on /media/user/mountpoint

/media/user/mountpoint was rwx rwx rwx while /media/user was rwx r-x ---

so i chmod o+rx /media/user then suddenly symlink to /media/user/mountpoint appeared on http://localhost/

I was able to click through my windows folder.

Thanks you so much people.
 
Top