Sudo root, to make a chown

Hello,

I’m trying to do a rsync on a folder generated by ruby on Rails.
But the main problem is that every generated stuff is nobody nobody.

So I’m trying to chown, but the ruby service through apache is not root.

So I wonder how can I execute action as a root.
Is there any sudo stuff in ruby so I can do my chown on my files an
directories, then an rsync.

Thanks

Hi David,

I’m trying to do a rsync on a folder generated by ruby on Rails.
But the main problem is that every generated stuff is nobody nobody.

So I’m trying to chown, but the ruby service through apache is not root.

So I wonder how can I execute action as a root.
Is there any sudo stuff in ruby so I can do my chown on my files an
directories, then an rsync.

You can execute commands in Ruby using backticks (e.g. sudo chown) but
I think the truly solution lies in fixing the permissions in the first
place. Try to configure the user that the Rails instance runs as. How to
do that depends on if you’re using FastCGI, Mongrel or mod_rails.


Roderick van Domburg

You can execute commands in Ruby using backticks (e.g. sudo chown) but
I think the truly solution lies in fixing the permissions in the first
place. Try to configure the user that the Rails instance runs as. How to
do that depends on if you’re using FastCGI, Mongrel or mod_rails.

I’ve tried system() but as the process is not root root I can’t change
the right to root root.

I’m using mod_rails. My rsync is into an action of a controller.

How can I set default file creation root root for a virtual host ?
I’m not familiar with apache and mod_rails.

David N. wrote:

I’m using mod_rails. My rsync is into an action of a controller.

How can I set default file creation root root for a virtual host ?
I’m not familiar with apache and mod_rails.

Check out the user switching and default user configuration options in
the mod_rails documentation.
Reading up on Apache configuration will be required unless you outsource
it :slight_smile:


Roderick van Domburg