0

I am currently using Capistrano to deploy a Rails application on Ubuntu 16.04. I have the configuration to use the root user master but am getting the following error when running the deployment check.

01 mkdir -p /var/www/pdtracker/shared /var/www/pdtracker/releases
01 mkdir: cannot create directory ‘/var/www/pdtracker’
01 : Permission denied
01 mkdir: cannot create directory ‘/var/www/pdtracker’: Permission denied

Not sure if I need to post more information as this is my first Ubuntu question. Should I change folder permissions perhaps? Any suggestions?

This is the command I am running that produces the error: sudo cap production deploy:check

  • What is "the root user master"? Is the user master or is it root? – mikewhatever Dec 11 '17 at 19:47
  • 1
    Please include the exact command you are typing. You're probably running it as normal user. – vidarlo Dec 11 '17 at 19:47
  • Have you tried a sudo -H -u www-data <command> this should run the commands as user www-data which has access to write to that folder – John Orion Dec 11 '17 at 19:50
  • @JohnOrion My apologies, I am running this as sudo. – Trenton Tyler Dec 11 '17 at 20:05
  • yeah i saw the edit ... but .. again the -H -u www-data added to the sudo command runs the command as user www-data which should have access to write to the www directory as long as the www directory is owned and grouped by www-data:www-data – John Orion Dec 11 '17 at 20:15
0

I haven't used Capistrano yet, but most of the installation guides say that by default the process will be run by the user deploy which we create during the installation.

So i think the user deploy has no permission to create a directory under /var/www/ and that's why this error occurs.

So changing the user of /var/www/ to deploy should fix the issue.

So first check if there is /var/www/. If no create it using the following command.

sudo mkdir /var/www/

And next change the user of that directory to deploy.

sudo chown -R deploy:www-data /var/www/

Note: Some installation guides say the username as deployer. So you need to make sure that which username you are using.

For more : Please refer the Authorisation section in the official documentation

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.