Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

OK, I formatted my flash to ext4 file system, changed all the permissions to 777 and mounted it to /var/www/html/web.

Now, when i access localhost/web it gives the following error:

"You don't have permission to access /web/cv on this server."

But when I normally access localhost it loads index.html that locates in /var/www/html directory, it means it has to do with mounting of flash.

Can't I hold my web directory inside my flash card in Linux? Why it gives permission error, maybe it could be related to Apache server? All guesses and solutions would be greatly appreciated.

BTW I am using Redhat Linux Enterprise Server 6

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You're probably running into SELinux issues. The directories on the flash drive probably aren't labelled such that httpd_t can touch them. You can do a setenforce 0 ; service httpd restart and attempt to access again to confirm. If that is what's going on then you can either configure SELinux to go into permissive mode (last ditch "just trying to get it to work" solution) or run a recursive restorecon on /var/www

share|improve this answer
    
wow, that actually worked, though i have no idea what "setenforce 0" really did:) –  Elvin Aslanov Jun 10 '13 at 11:25
    
It temporarily switches SELinux into permissive mode, where it will log all denials but not actually deny the operations. It's just a useful command for determining if SELinux is the problem. Your issue is probably the labeling issue, in which case doing the recursive restorecon after it's mounted should cause all files and directories to be re-labeled with something SELinux will allow httpd_t processes access to. –  Joel Davis Jun 10 '13 at 12:02
add comment

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.