Skip to content

Setting USER GROUP permissions after rsync

Adam Stokes edited this page Mar 19, 2015 · 1 revision

By default rsync will set the owner/group of the deploy.user set in your config. With rsync versions 3.1.0 and above you can set an alternate user/group with the following:

activate :deploy do |deploy|
  deploy.method = :rsync
  deploy.host = 'myserver.com'
  deploy.path = '/srv/blog'
  deploy.user = 'root'
  deploy.clean = true
  deploy.flags = '-avz --chown=www-data:www-data'
  deploy.build_before = true
end

This will use the root user to deploy and set www-data for all the files in /srv/blog. Make sure to include the -avz flag as it will overwrite the default flags.