Running RClone under another program/user in Linux

I have an install of Xubuntu that I use as a combination media/backup server. I have it setup with a program called Urbackup which creates various full and incremental backups of a couple computers on my home network.

Urbackup has the ability to call a post script after its backup is complete, so I tried to set it up so that it would run an rclone bash script to then sync some of the more important stuff to my gdrive account.

However, I’m running into an issue with how rclone seems to have different config files for different users. Urbackup has it’s own ‘user’ that is used to perform its tasks, so when it tries to run rclone, rclone looks for urbackup’s config file, and not the one that I set up with my gdrive information under my own user.

I cannot actually log in as this urbackup user as far as I know, as it was created when I installed the urbackup program, and I have no password for it.

Any thoughts as to how I could perhaps setup a ‘global config’ that works for the entire machine instead of a user? Or maybe someone has another solution in mind. Thanks for the help!

You can use the --config parameter to supply the location of a config file so you could use that.

You’ll need to be a bit careful with permissions though if you do that.

I think I would log in as urbackup and create its own rclone config file.

Something like

sudo -i # log in as root
su - urbackup -s /bin/bash

will probably get you logged in as urbackup.

Yes, that did work to get me under the urbackup user. So I was able to edit that version of the config file. Thanks for the help on that!

However, I now have another hiccup. Seems rclone, or probably urbackup is having an issue creating a temp config file?

This is the error that urbackup spits out in its log file after attempting to run my rclone bash script:

Script output Line(1): 2018/03/26 17:03:17 Failed to create temp file for new config: open /var/.rclone.conf445304603: permission denied

What I find confusing is that file location. According to --config string urbackup’s version of the config file is in:
/var/urbackup/.config/rclone/rclone.conf

So I’m not sure what’s going on there. Does rclone create its temp files in the var directory normally? I’m not sure how to get around this permission error without either changing where temp files go, or adjusting the permissions of where it is right now. But since that’s the root of the VAR directory, I’d rather not do that. Thanks again!

I suspect the environment is a bit strange when urbackup runs and is missing the HOME environment variable.

If you pass in --config /var/urbackup/.config/rclone/rclone.conf then I think it might run properly.

Or if you prefer you can set the HOME environment variable export HOME=/var/urbackup will do it I think.

Awesome, passing in the --config location worked! Just did a successful urbackup, and rclone sync. Thanks a lot for the help!

Glad you got it working :slight_smile: