Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Nov 22 '11 at 4:46

This question came from our site for professional and enthusiast programmers.

    
ls -ld /vol/www? –  Marc B Nov 21 '11 at 20:58
    
output is: drwxr-xr-x 3 root root 4096 2011-11-22 04:35 /vol/www –  user938363 Nov 21 '11 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 '11 at 3:06
    
follow answer on the post : superuser.com/questions/19318/… and it did not work. –  user938363 Nov 22 '11 at 4:05

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

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
share|improve this answer
    
Tested solution above (chgrp and chmod) and it did not work. The error is the same. Thanks. –  user938363 Nov 22 '11 at 16:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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