André Figueira

Systems engineer - I write apps, I make websites, opinions are my own...

How to fix Capistrano permission denied on run

The error

fatal: cannot exec '/tmp/': Permission denied

The reason

The server you're deploying to, does not allow the execution of executables within the tmp directory, which is where Capistrano uploads

The solution

Within either your specific environment config or in your global deploy.rb add the following line:

set :tmp_dir, "/home/deploy"

This sets the temporary dir Capistrano uses to the home folder of the deploy user, where it will have permission to execute. If you want, you can also create a tmp folder under the home of the deploy user, but that would require additional work to do.