Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I tried to put site files on an encrypted disk that's mounted to /media and got

(13)Permission denied: AH00035: access to / denied (filesystem path '/media/username/partition') because search permissions are missing on a component of the path

So I checked /media/username directories and they are drwxr-x---. I don't really remember if that was my fault or is it standard behavior. Is it possible to still have apache sites on a mounted media without giving every user permission to list it?

share|improve this question
    
Possibly can do by creating virtualhosts the configuration pointing to the needed location. How is the current approach of your public directory? is it simply under /var/www that is pointed to?? or are you having multiple websites enabled? –  AzkerM Mar 8 at 15:38
    
Have you really read my question? –  int_ua Mar 10 at 9:23

1 Answer 1

Yes you can; You must enable execution for all directorys and reading flag for every file to www-data user. Obiouvsly the www-data user must be the owner or in the file's group.

You can use this command:

chgrp -R www-data /yourdir
find /yourdir -type d -exec chmod 775 {} +
find /yourdir -type f -exec chmod 664 {} +
share|improve this answer
    
Have you really read my question? –  int_ua Mar 10 at 9:23
1  
I read it again. I try to explain my thoughts: the data security are maintained by the fact that only the owner of the file and www-data group can read the file on the mounted media. You can't read something in your media without having read permission on file and execution permission on all the folder to the path. The script that I've suggested to you, it's not one time fix, it's the initial configuration of the folder, and then it's not necessary other modification. If this doesn't help you: please explain better your trouble. –  gafreax Mar 13 at 9:41
1  
@gafreax "only the owner of the file and www-data group can read the file on the mounted media" ... No, you're using 775 and 664. You're making the files and directories accessible for the whole world. You want 770 and 660. –  Steven Kath Mar 15 at 1:32
1  
@gafreax Also, instead of those two find ... -exec chmod commands, you could just run chmod -R ug=rwX,o= /yourdir. The capital X will only set the execute (search) bit for directories, so one command works for both. –  Steven Kath Mar 15 at 1:32
1  
@StevenKath yes the correct mode is 660 and 770, my fault. –  gafreax Mar 15 at 8:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.