change www-data to your own username

To be able to upload files through the sftp server and the website being able to use the files without constantly having to “chown” the files you can do 2 things.

  1. Change the www-data group to use your user as membership. however this option is not ideal because the file permissions need to be set to group aswell instead of just user.
  2. change the user which is used by apache from www-dat to your own username. This is a better solution, provided that your username and password combination is not a security risk in the first place

You do this by editing the httpd.conf file or when you are using a Debian based distro the apache2.conf file change the following from www-data to your username and groupname

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

for example

export APACHE_RUN_USER=thura
export APACHE_RUN_GROUP=thura

One thought on “change www-data to your own username

  1. This only works if you do not use any other webservices on the same server. For example I use the webinterface for pihole on lighthttpd and this won’t update anylonger after using this method

Leave a Reply

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