Wednesday, May 8, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 9044  / 1 Year ago, sun, april 30, 2023, 7:45:51

I just install apache2 on ubuntu,the default www directory is /var/www/ ,I use ln to link it to '/media/Software/Program Files/wamp/www/' at the windows directory,but the apache shows 'You don't have permission to access / on this server',Then I use 'sudo chmod -R 777 /media/Software/Program Files/wamp/www/' to set the permission,but it didn't work,and nothing changed when I saw the permission in the preporties of the '.../wamp/www' folder.So I want to know How can I change the www directory to '.../wamp/www' as I also need to access this diretory in windows.


More From » dual-boot

 Answers
1

There are two things around.



One is whether Apache is allowed to follow symlinks. Is you link a symlink via ln -s? It is the recommended way but it might be a security issue in some servers and it is disabled many times.



See https://superuser.com/questions/244245/how-do-i-get-apache-to-follow-symlinks for more info on that topic but esentially you need AllowOverride None as here:



<Directory />
Options FollowSymLinks
</Directory>


Other topic is the permissions.



Windows Partition



As it is a Windows directory (it seems so) the best option will be to follow this guide http://ubuntuforums.org/showthread.php?t=1604251:



Essentially it recommends you to edit the /etc/fstab
The line should be like this one:



/dev/sdb5 /media/Software ntfs-3g defaults, ..., umask=227 0 0


The interesting part is the umask. I will recommend to put the last digit as 6 or 7 for allowing Apache to access.



The recommended way is to use UUID. The steps are:



0) Make a backup of fstab (just in case ;))



sudo cp /etc/fstab /etc/fstab.bak


1) Get the UUID of your hard-drive:



sudo blkid


2) Add the line in fstab



It should be something like this:



UUID=$you_uuid  /media/Software  ntfs-3g  defaults,user,auto,utf8


I have added auto so that it auto mounts. If you don't want that use noauto instead.



This will give it full permission. If you prefer different permissions use dmask=000,fmask=111 as options. Instead of the it uses different numbers than chmod. If you want you can add also uid=100,gid=100 with the wanted another uid or gid.



References:
https://help.ubuntu.com/community/Fstab
How to automount NTFS partitions?
http://ubuntuforums.org/showthread.php?t=283131



Linux/Unix Partition (if not using Windows partitions)



If it is not a Windows partition the permissions should be in the standard linux way.



The best option is to change the permission of that directory. I will do it in this way:



chgrp -R www-data /media/Software/Program Files/wamp/www/


Also you will need read permission (maybe write) for that directory. It is done in this way:



chmod g+r /media/Software/Program Files/wamp/www


For also adding write:



chmod g+rw /media/Software/Program Files/wamp/www


But again that won't work if the partition is a NTFS partition because Windows do not store permission in the disk in this way.


[#34048] Monday, May 1, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bunsistent

Total Points: 198
Total Questions: 108
Total Answers: 121

Location: Monaco
Member since Sun, Jan 16, 2022
2 Years ago
;