Having recently upgraded to Debian 13 for my workstation, I continue to develop web applications with a local Apache server. The problem is that to edit files in /var/www/html, I have to make the changes as root via my IDE.
The solution to this problem is to add yourself to the www-data group so that read/write permissions apply, and finally give the group the appropriate permissions.
This configuration is not recommended for production use. I personally use it for my development environment.
Run the following commands in order:
- Changing the owner of the folder to put his login, and adding him to the www-data group
- Grant read/write permissions to the www-data group for the folder and its subdirectories
sudo chown -R USERNAME:www-data /var/www/html
sudo chmod -R 775 /var/www/html
Replace USERNAME with your username
The change should apply instantly, if not, remember to log out and log back in.