Change Apache User in Ubuntu

On Ubuntu/Debian server, apache run as user www-data. When you install Apache web server on your local computer for developement purpose, it may be easier to run Apache as your user. If you run Apache as www-data user, you will need to chmod folders 777 for yoru web application to write to a folder like file upload, creating log files etc..

To change Apache user, edit file

1vi /etc/apache2/envvars

Find and replace www-data with your user name. You can do this with following sed command

1
2
sed -i “s/www-data/USERNAME/g” /etc/apache2/envvars
chown -R USERNAME:USERNAME /var/lib/php

Leave a Comment

Your email address will not be published. Required fields are marked *

Hire a server Expert to resolve the issue Now.

Hire a server Expert to resolve the issue Now.

Resolve this issue in just 5$ from https://serverexpert.io

 

You have Successfully Subscribed!

Open chat