Find the answer to your Linux question:
Results 1 to 7 of 7
Hi all, I've installed apache and all is working but when I try to extract anything to the /var/www/html/ I get the following error in the browser: Forbidden You don't ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2012
    Posts
    4

    Forbidden You don't have permission to access


    Hi all,

    I've installed apache and all is working but when I try to extract anything to the /var/www/html/ I get the following error in the browser:

    Forbidden

    You don't have permission to access /Symfony/web/config.php on this server.

    However, when I create a my own files, for example, /var/www/html/test_dir/test.html I can view them in the browser.

    Thanks!!

  2. #2
    Just Joined!
    Join Date
    Feb 2011
    Posts
    21
    Permission problem on the file. Most likely owned by root

    As root:

    chown username:username <file>

    For a recursive ownership of a directory and its contents:

    chown -R username:username <directory>

  3. #3
    Just Joined! pradeeprajkumar's Avatar
    Join Date
    Jun 2010
    Location
    India
    Posts
    72
    By default, the www directory will be owned by root user.
    So, if you just want to change some configuration files in it, then you can simply switch user to root and manipulate the files.
    But this will not work for GUI apps like filezilla to edit the files under www directory, so in that case you have to change the owner of that folder from root user to your normal user.

  4. #4
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Quote Originally Posted by pradeeprajkumar View Post
    But this will not work for GUI apps like filezilla to edit the files under www directory, so in that case you have to change the owner of that folder from root user to your normal user.
    You don't have to change ownership of the directory in order to gain access to modify files under it.. What you should do is change the permissions. If memory serves me correctly /var/www/html is 755 <rwxr-xr-x> changing this to 775 <rwxrwxr-x>will give group users access to modify files in that directory.

    However it is not a good idea to do it this way. A better way is to modify the group and then users you want to give modify rights to add them to that group. You just need to change the permissions then to 775 <rwxrwxr-x>

    Also keep in mind that any directory that doesn't need to be able to execute files should not be set to allow it. 766 <rwxrw-rw-> Especially if it is public facing. And on those public facing directories if you must have execute permissions then you shouldn't allow edit rights to anyone but owner and group 775 <rwxrwxr-x>.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  5. #5
    Just Joined!
    Join Date
    Feb 2012
    Posts
    4
    Thanks so far.

    A related question then: If I unpack a tar in my home directory and then move it to /var/www/html/ why am I unable to view (Forbidden You don't have permission to access on this server) the files in the browser even if I change the owner to root and chmod to 777?

    If I unpack under /var/www/html then I have no problems viewing the files on the browser.

    Thanks again.

  6. #6
    Just Joined! pradeeprajkumar's Avatar
    Join Date
    Jun 2010
    Location
    India
    Posts
    72
    Quote Originally Posted by Lazydog View Post
    You don't have to change ownership of the directory in order to gain access to modify files under it.
    I had the same access problem some time ago,I used the chmod 777 <path to HTML directory> command.
    but even after granting all permissions to all people, the files in the html are not accessible from outside(i.e, through filezilla).
    so I came to a conclusion that filezilla is started from normal user,but the html file resides inside the root directory and we have to add/change the owner of the irectory to normal user from root user.
    here is the thread which I've posted earlier:
    http://www.linuxforums.org/forum/red...directory.html

  7. #7
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,882
    The standard Apache install comes with a lock-down <Directory ...> statement for its html-root directory. You should consider adding new <Directory ...> definitions for each directory you want it to grant access to. There are examples of this in the standard httpd.defs file, and it's a subject that's well documented on t'internet.
    Linux user #126863 - see http://linuxcounter.net/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •