Mount remote using encrypted rclone.conf

What is the problem you are having with rclone?

Can't mount remote using an encrypted rclone.config

What is your rclone version (output from rclone version)

rclone v1.49.1

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Linux/amd64

Which cloud storage system are you using? (eg Google Drive)

Google drive

Hi,
I'm currently using a systemd script to mount a Google Drive remote and it works fine and looks like this:

[Unit]
Description=Mount and cache Google drive to /media/###
After=syslog.target local-fs.target network.target
[Service]
Environment=RCLONEHOME=/home/###/.config/rclone
Environment=MOUNTTO=/media/###
Environment=LOGS=/home/###/logs
Environment=UPLOADS=/home/###/uploads
Type=simple
User=root
ExecStartPre=/bin/mkdir -p ${MOUNTTO}
ExecStartPre=/bin/mkdir -p ${LOGS}
ExecStartPre=/bin/mkdir -p ${UPLOADS}
ExecStart=/usr/bin/rclone mount
--rc
--log-file ${LOGS}/rclone.log
--log-level INFO
--umask 002
--allow-non-empty
--allow-other
--tpslimit 10
--tpslimit-burst 10
--dir-cache-time=72h
--drive-chunk-size=512M
--buffer-size=1G
--attr-timeout=1s
--vfs-read-chunk-size=128M
--vfs-read-chunk-size-limit off
--vfs-cache-max-age=5m
--vfs-cache-mode=writes
--cache-dir ${UPLOADS}
--config ${RCLONEHOME}/rclone.conf
Gdrive: ${MOUNTTO}
ExecStop=/bin/fusermount -u -z ${MOUNTTO}
ExecStop=/bin/rmdir ${MOUNTTO}
Restart=always
[Install]
WantedBy=multi-user.target

However, this works unless my rclone.config is not encrypted. Whenever I encrypt it, the mount script breaks.

Of course, I am aware of the fact that the script isn't able to read the config any longer as it is encrypted... that's obvious!
Accordingly, there must be a possibility to store the password for the config in the mount script or (would be better) to refer to a location where to read the pw from?!

Thank you for your help
Cheers
Herald

Have you read through the relevant documentation?
https://rclone.org/docs/#configuration-encryption
Because that does detail ways to deal with exactly this, so it's the first place to start.

If your scenario is not covered by this somehow, or you are unable to do what the documentation suggests - point out exactly where it fails or how your setup is different to what is described.

By the way - aren't you supposed to use

at the end of every line (except last) in a multi-line command like what you are doing for your rclone mount command? I'm not a regular Linux user so I may be wrong, but that's generally how bash works, so unless it's some difference of formatting in a service file specifically.

Thank you! I've read that and it works in case of manual mounting a remote by typing the mount commands + eg flags.
However, let's say after a reboot I will have to source it (the set-rclone-password file)again, won't be so? The main idea of my script is to automatically mount the remote on a system start. I suggest that I will have to source the file again before mounting the remote.
You may suppose me as stupid but I don't get it. Sorry, I am new in that field.

... suppose to use what...?

In your systemd service file, you can add the password:

If it is safe in your environment, you can set the RCLONE_CONFIG_PASS environment variable to contain your password, in which case it will be used for decrypting the configuration.

So

Environment= RCLONE_CONFIG_PASS=somepassword
1 Like

Thanks. That should work

Sorry, the forum formatting ate the spacial characher (nom nom!).
What I tried to show you was
\

I think Animosity covered your other question adequately :slight_smile:
Also he's the Linux guy so if there some different formatting in the service compared to bash, he would be the one to know. I just want to make sure you aren't accidentally skipping your flags

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