Results 1 to 10 of 10

Thread: [SOLVED] Permission to write to /var/www/ ?

  1. #1
    Join Date
    Jun 2008
    Beans
    19

    [SOLVED] Permission to write to /var/www/ ?

    I got a lamp server up and running with Tasksel and found the right directory to save my files in (/var/www/), but when I try to save files in it, I get an error that says I don't have the permissions necessary to save the file.

    How to I grant these permissions? Thanks for your help!

  2. #2
    Join Date
    Jul 2007
    Location
    London
    Beans
    262
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Permission to write to /var/www/ ?

    If the files are being written via the web application, then the user that Apache is running as needs to have permission to write to the directory.

    e.g.

    Code:
    chown apache /var/www

  3. #3
    Join Date
    Feb 2006
    Location
    Santa Cruz, CA
    Beans
    107
    Distro
    Ubuntu

    Re: Permission to write to /var/www/ ?

    You need to move or copy the files as root (you have to be admin / know the root password in order to do this though). You can do this by adding sudo in front of the command you are using. EX.
    Code:
    sudo mv ./file /var/www/location/
    or alternatively, if you are trying to save text with gedit, open the text file with
    Code:
    sudo gedit filename&.
    and you will have root power to save anywhere
    Last edited by Bakerconspiracy; July 3rd, 2008 at 08:43 PM.
    And everyone thought I was crazy because all I wanted was noodles noodles noodles noodles noodles noodles noodles noodles...

  4. #4
    Join Date
    Jun 2008
    Beans
    19

    Re: Permission to write to /var/www/ ?

    I tried doing cd /var/www/ then sudo gedit test.php, and got the test file saved properly. Now when I try to open it, I get this:



    What am I doing wrong?

  5. #5
    Join Date
    Jul 2007
    Location
    London
    Beans
    262
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Permission to write to /var/www/ ?

    You need to PHP enable Apache

    https://help.ubuntu.com/community/ApacheMySQLPHP

  6. #6
    Join Date
    Jun 2008
    Beans
    19

    Re: Permission to write to /var/www/ ?

    I used Tasksel to install a lamp server which is supposd to include apache, mysql, and php.

  7. #7
    Join Date
    Jul 2007
    Location
    London
    Beans
    262
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Permission to write to /var/www/ ?

    Quote Originally Posted by Neureo View Post
    I used Tasksel to install a lamp server which is supposd to include apache, mysql, and php.
    Then it didn't work as Apache doesn't know how to interpret PHP files Perhaps restart Apache? You could also post your Apache conf. You installed like this:

    Code:
    sudo tasksel install lamp-server
    yes?
    Last edited by Xerp; July 3rd, 2008 at 09:28 PM.

  8. #8
    Join Date
    Jun 2008
    Beans
    19

    Re: Permission to write to /var/www/ ?

    Well...I did sudo tasksel, then selected LAMP server and hit enter, which I expect is the same thing. I did this only a few minutes ago and didn't change any settings.

  9. #9
    Join Date
    Nov 2007
    Location
    NC, USA
    Beans
    829
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Permission to write to /var/www/ ?

    Chown it to the user and group www-data, which should be the user that Apache is running under.
    Linux User #460341 || Ubuntu User #19510 || Unanswered Posts Team

  10. #10
    Join Date
    Jun 2008
    Beans
    19

    Re: Permission to write to /var/www/ ?

    Ok, I did chown www-data:www-data /var/www/, then cd /var/www/, then sudo gedit php_test.php and wrote and saved my file, and now it appears to be working great! Thanks, guys.

Bookmarks

Posting Permissions

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