Archive for the ‘file transfer’ tag
Capistrano: Uploading file with different owner
Normally when working with capistrano, you choose to execute your commands on remote machine with a root user or non-root user. For root level activity, you don’t actually use “root” account but instead provide a “deploy” user “sudo” privileges and then leverage capistrano’s “use_sudo => true” option.
This still leaves you out in cold when you want to transfer a file and put it in a directory where your sudo user doesn’t have permission. In theory, what this needs is transferring/uploading/scp/sftp-ing that file to a /tmp and then using “sudo mv old_location new_location” to accomplish the task.
I ended up writing a utility method to do this but kept wondering that the need is so common that an inbuilt (and better) utility should exist. And then I found std.su_put.