Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt
hiddentrue

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.

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-path> on a root360 natgw so that the resulting files are owned by www-data instead of your project user <project-user>:

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

To get even more complex, this command below The next command copies from a local instance to an instance behind a root360 natgw, which is useful to copy data owned by www-data between application instances of your prod and test/stage environments. Take care to use ssh -A to connect to the source instance so that it can access your private key which it needs to connect to the other natgw.:

$ rsync -rv --rsync-path 'sudo -n -u www-data rsync' -e 'ssh -J <remote-project-user>@<remote-bastion-host-ip>' <local-source-path> <remote-project-user>@<remote-application-instance-ip>:<destination-path>

$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:

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

Related tutorials

Filter by label (Content by label)
showLabelsfalse
max10
showSpacefalse
cqllabel in ( "ssh" , "application" , "ec2" ) and space = currentSpace ( ) and ancestor = "2014352487"

Related components

Filter by label (Content by label)
showLabelsfalse
max10
showSpacefalse
cqllabel in ( "ssh" , "application" , "ec2" ) and space = currentSpace ( ) and ancestor = "2014350220"

Status
colourYellow
titleintermediate

Table of Contents
exclude(Related * | Recommended * |Table of contents).*


Filter by label (Content by label)
showLabelsfalse
max10
sorttitle
showSpacefalse
titleRelated questions
cqllabel in ( "ssh" , "application" , "ec2" ) and space = currentSpace ( ) and ancestor = "2014351598"