Config file used under Sudo changed

Hi all,

I've recently upgraded my install of RClone from 1.47 to 1.49.3 on an Ubuntu 18.04.3 LTS Server and am running into an odd issue.

I have a number of backup jobs set using scripts fired off in the root crontab which started failing after the update. It looks like for some reason now that when running sudo it is using my standard accounts config file which doesn't have any remotes configured instead of the config file under root. Also any new remotes I configure with 'sudo rclone config' also go into my standard user config?

If I run rclone config file I get the below which is fine:
Configuration file is stored at:

but if I run sudo rclone config file I get:
Configuration file is stored at:

where I used to get:
Configuration file is stored at:

Have I gotten some permissions wrong or has something changed in the code now where running sudo/root still uses the standard config file rather than the config file stored in the root directory?

Help would be much appreciated.

That's definitely a bit strange and the upgrade should not cause that.

What does this show?

[felix@gemini ~]$ sudo env | grep RCLONE

Strange indeed. It should definitely work as you expected it to. A different user will have a different config location by default (a source of confusion for many beginners actually).

The only thing I know that overrides this is if you have an rclone config file in the same folder as rclone.exe . In that case it will always use that no matter what. Useful to be aware of - but that does not seem to be the case here.

I am not aware that this behavior has changed in any recent versions. NCW is very conscious about making any changes that would break existing configurations, so it is extremely unlikely he would do anything like this outside of maybe a full version 2.0 overhaul in the future.

If it is a Linux spesific issue I have to leave you in Animosity's very capable hands...

Doesnt display anything with upper or lowercase rclone. My output of just sudo env is below:















Just for fun, what happens when you flip over all the way?

[felix@gemini ~]$ sudo su -
Last login: Fri Sep 27 14:07:08 EDT 2019 on pts/0
[root@gemini ~]# rclone config file
Configuration file doesn't exist, but rclone will use this path:
[root@gemini ~]#

This is probably the culprit. Any changes recently that may affected this? Generally, in Ubuntu, any sudo command preserves the HOME directory by default so the config in the /root shouldn't have been used even with the earlier versions of rclone.


That would be it:

[root@gemini ~]# HOME=/blah
[root@gemini root]# rclone config file
Configuration file doesn't exist, but rclone will use this path:

Always love to learn something new as I that makes perfect sense.

So 1.48 had this change item:

Use go-homedir to read the home directory more reliably (Nick Craig-Wood)

Would surmise that picks up the home directory better which is the fix that caused the issue to pop up.

[root@gemini rclone-v1.47.0-linux-amd64]# ./rclone config file
Configuration file doesn't exist, but rclone will use this path:
[root@gemini rclone-v1.47.0-linux-amd64]# cd
[root@gemini ~]# rclone config file
Configuration file doesn't exist, but rclone will use this path:
1 Like

Yeah, looks like it.

Great find.

Yes that is it... the use of go-homedir

Rclone has enough users now that for every bug I fix, I break someone's workflow who was relying on that bug!

Can't exactly worry about that - bugs aren't features :smiley: (well, outside the corporate world anyway).
Very nice catch Animosity.

Ah ok well that explains it!

What would be the best way for me to update the config file under root now that sudo rclone config is editing my standard account config instead of roots. As root crontab is using the config file under root.

Or should I change the crontab jobs over to using my standard accounts crontab?


You want to fix root so it points to the proper home directory rather than another user. Not sure how that happened either. I'd check /etc/password first:

[root@gemini ~]# grep root /etc/passwd

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.