Permission error from touch -cm in :update_asset_mtimes #352

ammar opened this Issue Jan 11, 2013 · 3 comments


None yet

4 participants

ammar commented Jan 11, 2013

In lib/capistrano/recipes/deploy/assets.rb the :update_asset_mtimes task fails with a "Operation not permitted" error when executing touch -cm -- "$asset".

In the installation I'm working on the assets do not belong to the user running the deploy and touch will fail unless the file in question is owned by the user.

My guess is that this touch command should be run by sudo.

ammar commented Jan 11, 2013

In the meantime, as a workaround, I change the owner of all the assets to the current user with:

sudo "chown -R $USER:#{deploy_group} #{shared_path}/assets"

and after assets:precompile set it back to the runner with:

sudo "chown -R #{runner}:#{deploy_group} #{shared_path}/assets"

Ugly, to say the least.

The way I get around it is by doing this:

namespace :assets do
    task :update_asset_mtimes do ; end

This will skip the update_asset_mtimes task

@leehambley leehambley closed this Apr 2, 2013
doooby commented Nov 19, 2013

In my case the problem was solved by changing an owner for the whole app directory recursively to the app user. The thing is, I suppose, that I've managed once to call the assets:precompile task from server terminal which resulted in precompilling my assets with the root as its owner. Weird is though, that the root has still been an owner after any other deploy task for new versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment