(Archived) How to use www-data user

You have tried to access an archived page. Please go to the new https://root360.atlassian.net/wiki/spaces/KB to find more documents.

Application processes in root360 environments are run as the Unix-user www-data. Likewise, all application files (such as the files in your apache or nginx document roots) are owned by www-data.

To run a command as this user, use

sudo -u www-data command

As an example: to list the currently installed cronjobs on an application instance, you can use

sudo -u www-data crontab -l

Here is a more interesting example, an rsync command that copies data from <local-source-path> to /mnt/nfs/<destination> on a root360 natgw so that the resulting files are owned by www-data instead of your project user <project-user>:

rsync --rsync-path 'sudo -n -u www-data rsync' <additional-rsync-options> <local-source-path> <project-user>@<natgw-ip-destination>:/mnt/nfs/<destination>

$home of www-data

www-data does not have its own home directory. When you call commands with sudo -u www-data, you inherit $HOME from the calling user. In some cases you may want to manually set $HOME:

project-user $ HOME=/tmp/home; sudo -u www-data echo $HOME /tmp/home

 

root360 Knowledge Base - This portal is hosted by Atlassian (atlassian.com | Privacy Policy)