Help with systemd setup (permission issues?)

What is the problem you are having with rclone?

I am trying to setup systemd to run rclone mount after booting, but it is not working properly. The issues/symptoms are:

  • After reboot, right clicking on my mount (=/home/monQuee/rclone-GDrive) tells me that it is a binary instead of a directory. Checking permissions, I get permissions could not be determined. I cannot access the folder.
  • Accessing the file through sudo nautilus produces the expected behavior: I can access the folder, and the expected files are there. Right clicking reveals that permissions are set for root.
  • Similar issues with the log file and config file: they are displayed as binaries, with permissions only for root.

Run the command 'rclone version' and share the full output of the command.

rclone v1.63.1
- os/version: ubuntu 22.04 (64 bit)
- os/kernel: 6.2.0-26-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.20.6
- go/linking: static
- go/tags: none

Are you on the latest version of rclone? You can validate by checking the version listed here: Rclone downloads
--> Yes, as of Aug2023.

Which cloud storage system are you using?

Google Drive

The command you were trying to run.

My /etc/systemd/system/rclone-GDrive.service file is as follows:

[Unit]
Description=rclone-GDrive
AssertPathIsDirectory=/home/monQuee/rclone-GDrive
Wants=network-online.target
After=network-online.target


[Service]
Type=notify
ExecStart=/usr/bin/rclone  \
        --config=/home/monQuee/.config/rclone/rclone.conf \
        --vfs-cache-mode full \
	--vfs-cache-max-size 250G \
	--log-file=/home/monQuee/rclone-log \
	--log-level DEBUG mount GDrive: /home/monQuee/rclone-GDrive
ExecStop=/bin/fusermount -u /home/monQuee/rclone-GDrive
Restart=always
RestartSec=10

[Install]
WantedBy=default.target

The rclone config contents with secrets removed.

[GDrive-test]
type = drive
client_id = XXXX
client_secret = XXXX
scope = drive
root_folder_id = XXXX
token = {"access_token":"XXXX","token_type":"Bearer","refresh_token":"XXXX","expiry":"XXXX"}
team_drive = 

(all XXXX are redacted)

A log from the command with the -vv flag

This log was obtained after rebooting, and then running systemctl stop rclone-GDrive.

2023/08/15 22:22:13 DEBUG : rclone: Version "v1.63.1" starting with parameters ["/usr/bin/rclone" "--config=/home/monQuee/.config/rclone/rclone.conf" "--vfs-cache-mode" "full" "--vfs-cache-max-size" "250G" "--log-file=/home/monQuee/rclone-log" "--log-level" "DEBUG" "mount" "GDrive:" "/home/monQuee/rclone-GDrive"]
2023/08/15 22:22:13 DEBUG : Creating backend with remote "GDrive:"
2023/08/15 22:22:13 DEBUG : Using config file from "/home/monQuee/.config/rclone/rclone.conf"
2023/08/15 22:22:14 DEBUG : Google drive root '': 'root_folder_id = 0ADTqzZHzAjaRUk9PVA' - save this in the config to speed up startup
2023/08/15 22:22:14 DEBUG : vfs cache: root is "/tmp/rclone"
2023/08/15 22:22:14 DEBUG : vfs cache: data root is "/tmp/rclone/vfs/GDrive"
2023/08/15 22:22:14 DEBUG : vfs cache: metadata root is "/tmp/rclone/vfsMeta/GDrive"
2023/08/15 22:22:14 DEBUG : Creating backend with remote "/tmp/rclone/vfs/GDrive/"
2023/08/15 22:22:14 DEBUG : fs cache: renaming cache item "/tmp/rclone/vfs/GDrive/" to be canonical "/tmp/rclone/vfs/GDrive"
2023/08/15 22:22:14 DEBUG : Creating backend with remote "/tmp/rclone/vfsMeta/GDrive/"

add --allow-other flag to your mount command.

You run systemd as root so all permissions are set for it and only root can access this mount.

It is not really rclone issue but how linux works. You can also specify on behalf of which user run systemd service. All depends on your specific setup and requirements.

Awesome; thanks a lot. In case it helps someone else, let me mention that I was running into trouble using the syntax

--allow-other mount GDrive:...

and instead had to use

--allow-other=true mount GDrive:...

I think that, with the former, rclone thought that I was trying to assign the value mount to the variable allow-other, and then run the command GDrive, which does not exist.

1 Like

This did end up giving me new headaches after a while. I have now settled for running mount through systemd as user. My rclone-GDrive.system file now looks like:

[Unit]
Description=rclone-GDrive
AssertPathIsDirectory=/home/monQuee/rclone-GDrive
Wants=network-online.target
After=network-online.target


[Service]
User=monQuee
Group=monQuee
Type=notify
ExecStart=/usr/bin/rclone  \
        --config=/home/monQuee/.config/rclone/rclone.conf \
        --vfs-cache-mode full \
        --vfs-cache-max-size 250G mount GDrive: /home/monQuee/rclone-GDrive
ExecStop=/bin/fusermount -u /home/monQuee/rclone-GDrive
Restart=always
RestartSec=10

[Install]
WantedBy=default.target
1 Like

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