Skip to content

Instantly share code, notes, and snippets.

@frhan
Last active September 28, 2022 00:07
Show Gist options
  • Save frhan/993de2b494e47f1302d3 to your computer and use it in GitHub Desktop.
Save frhan/993de2b494e47f1302d3 to your computer and use it in GitHub Desktop.
the simplest way to edit and add files to “/var/www”
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+rw /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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment