Ubuntu – Whats the simplest way to edit and add files to “/var/www”

permissionswebserver

Having installed the web server is there a simple way to set a user able to use the graphic interface to copy files and directories to the local web server /var/www

I gave myself administrative privileges in Ubuntu but it still doesn't allow copies.

Best Answer

  • If you make /var/www writeable by its group and add the user to the group, that user will not have to use sudo. Try this:

    sudo adduser <username> www-data
    sudo chown -R www-data:www-data /var/www
    sudo chmod -R g+rwX /var/www
    

    The user should then be able to edit /var/www/ files without hassle.

    The first line adds the user to the www-data group, the second line clears up any files with messed up ownership, and the third makes it so that all users who are members of the www-data group can read and write all files in /var/www.

    If you are logged in as <username> you need to log out and log back in for the group membership to take effect.

  • Related Question