1

We are deploying our rails app on a ubuntu 10.04 server. When cap deploy:setup, there is a error saying that:

  * executing "mkdir -p /vol/www/myapp /vol/www/myapp/releases /vol/www/myapp/shared /vol/www/myapp/shared/system /vol/www/myapp/shared/log /vol/www/myapp/sha
red/pids"
    servers: ["11.15.69.45"]
Password:
    [11.15.69.245] executing command
*** [err :: 11.15.69.45] mkdir: cannot create directory `/vol/www/myapp/releases'

the output of ls -ld /vol/www is:

drwxr-xr-x 3 root root 4096 2011-11-22 04:35 /vol/www

What kind of additional rights do we need to assign on the web server and which subdir those rights need to be assigned to?

4
  • ls -ld /vol/www?
    – Marc B
    Nov 21, 2011 at 20:58
  • output is: drwxr-xr-x 3 root root 4096 2011-11-22 04:35 /vol/www
    – user938363
    Nov 21, 2011 at 22:06
  • You'd have to make them 0777 at least for a typical webserver process to have write access to that directory, then.
    – Marc B
    Nov 22, 2011 at 3:06
  • follow answer on the post : superuser.com/questions/19318/… and it did not work.
    – user938363
    Nov 22, 2011 at 4:05

2 Answers 2

1

There seems to be some confusion about your problem here. Andrew's answer addresses the issue, "does the web server have the proper permissions to write to the directly you're deploying to?"

However, you're actually having problems at an earlier stage: deploying your code to the server. At this phase, it doesn't matter so much whether the web server can write to /vol/www, but whether the user you're connecting as when you deploy the code has permissions to write to that directory.

Andrew's solution still basically applies, but slightly differently.

I'd recommend one of the following approaches:

  1. Since you've already set up /vol/www to be group-writable by the www-data group, you can just add your user to that group:

    sudo usermod -aG www-data your-username
    
  2. Or, you can make yourself the owner and give yourself access that way. Since you've already set up group access for the web server, changing the directory's owner shouldn't cause problems down the line.

    sudo chown your-username /vol/www
    

Either of those options should give your user the proper access to deploy the code, and also preserve the web server's access to that directory.

0

The web server user in Ubuntu is www-data (unless you're running with mod_suexec). So www-data needs write permission on /vol/www. One way to do it is by making www-data the owner:

chown www-data /vol/www

Or you could use group ownership and permissions:

chgrp www-data /vol/www
chmod g+w /vol/www

A third way is with ACLs:

setfacl -m u:www-data:rwx /vol/www
getfacl /vol/www   # to see the ACL grant
1
  • Tested solution above (chgrp and chmod) and it did not work. The error is the same. Thanks.
    – user938363
    Nov 22, 2011 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .