Change Ownership on download?

lisas4567

Member
May 25, 2018
773
0
16
Is there any way to change the ownership settings of files downloaded by rtorrent? Currently I'm running it as a daemon on startup, but this means it runs a root even if I have it set to use my regular user account settings. For a variety of reasons I need the end result to be accessible (writable) by my regular user account without any action on my part (currently I have to ssh into the server, su to root, and then chown them to my regular user account). I'm hoping there is an easy (safe) way to do that, because every way I know to do it will result in a security nightmare.
 

simur612

Member
May 25, 2018
879
0
16
which os are you using? theres a couple ways to do it, as brock said, you can use su -c, or you could use cron instead of an init script.

Which os are you on?
 

lisas4567

Member
May 25, 2018
773
0
16
I actually have a similar question. I have a separate (rtor) user that actually runs rTorrent as a daemon, so as not to expose the system if hijacked. I never actually log in as rtor, however, so I'd love if downloads where chowned to my normal user account upon completion.
 

simur612

Member
May 25, 2018
879
0
16
your best bet is to use a group or umask.

if you set umask to 0000 in rtorrent, all files will be created as 666 and all dir's 777

or put both users in some group and set umask to 0002
 

saroos1

Member
May 25, 2018
718
0
16
You could create a cron job that chown's the directory recursively to the user of your choice.
 

simur612

Member
May 25, 2018
879
0
16
that could be a bad idea depending on what the permissions are and what you want to make them.