I have my system configured to do rclone selfupdate via a shell script that updates other things. This worked until rclone actually found an update, at which point, this: Error: /usr/bin/rclone: file is not writable, run self-update as root
It would be better were rclone to request elevation, interactively. For if I replace rclone selfupdate with sudo rclone selfupdate, then even the check for updates requires root; thus, I have to grant root access - via entering my password, unless I give the whole script root - even if there is no update to perform. What if I do give the whole script root? Then, again: even if there is no update (of rclone or anything else) to perform, I must enter the password - unless I use sudoers and unless something else in the script has caused elevation. I could use sudoers. I would rather though that rclone prompted for elevation when and indeed only when it needs to install an updated version.
Also: sudo rclone selfupdate performs the update but also spits out the following. NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults. That message seems to suggest that I am trying to make rclone perform its normal operations as root.
Sudoers: I know how it works. The point is as follows. Programs should be given elevated permissions only when they need them. The rclone update check does not need elevation - only the actual update does.
The message about the lack of a config file does have the connotation that one intends to run rclone as root, and that connotation is unfortunate because (1) most people will not do that, (2) doing it would be a bad idea.
I was unaware of rclone selfupdate --check. That command looks good, except that seemingly, in order to use it in a script, I have to write a way of parsing its output.
Thank you both. (I note that the linter called 'shellcheck' recommends some extra quoting of variables. But ivandeex's method is much simpler than the one I proposed!)