Systemd mount with password on linux

What is the problem you are having with rclone?

I try to auto mount with systemd but fails to do so. I export the RCLONE_CONFIG_PASS and it shows in enviroment; printenv, but it still ask for password.

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

rclone v1.59.0

  • os/version: arch 21.3.3 (64 bit)
  • os/kernel: 5.4.204-1-MANJARO (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.18.3
  • go/linking: dynamic
  • go/tags: none

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

Wasabi

The command you were trying to run (eg rclone copy /tmp remote:tmp)

[Unit]
Description=RClone Service
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
ExecStart=/usr/bin/rclone mount my-cloud-storage: /home/anonymous/CloudStorage --config /home/anonymous/.config/rclone/rclone.conf --vfs-cache-mode off -vv --buffer-size 16Mi
ExecStop=/bin/fusermount -uz /home/anonymous/CloudStorage
Restart=on-abort

[Install]

WantedBy=default.target

The rclone config contents with secrets removed.

[wasabi]
type = s3
provider = Wasabi
access_key_id = 
secret_access_key = 
endpoint = s3.eu-central-1.wasabisys.com
acl = private

[pc-bu]
type = crypt
remote = wasabi:pc-bu
password = 
password2 = 

[laptop-bu]
type = crypt
remote = wasabi:laptop-bu
filename_encryption = off
directory_name_encryption = false
password = 
password2 = 

[my-cloud-storage]
type = crypt
remote = wasabi:my-cloud-storage
password = 
password2 = 

[mb-bu]
type = crypt
remote = wasabi:mb-bu
password = 
password2 = 

[tlf-bu]
type = crypt
remote = wasabi:tlf-bu
filename_encryption = off
directory_name_encryption = false
password = 
password2 = 

A log from the command with the -vv flag

× rclonemount.service - RClone Service
     Loaded: loaded (/etc/systemd/system/rclonemount.service; enabled; vendor p>
     Active: failed (Result: exit-code) since Sun 2022-07-17 01:00:24 CEST; 10s>
    Process: 96758 ExecStart=/usr/bin/rclone mount my-cloud-storage: /home/anon>
   Main PID: 96758 (code=exited, status=1/FAILURE)
        CPU: 68ms

jul 17 01:00:24 anonymous-lap systemd[1]: Starting RClone Service...
jul 17 01:00:24 anonymous-lap rclone[96758]: 2022/07/17 01:00:24 DEBUG : Failed>
jul 17 01:00:24 anonymous-lap rclone[96758]: DEBUG : rclone: Version "v1.59.0" >
jul 17 01:00:24 anonymous-lap rclone[96758]: DEBUG : rclone: systemd logging su>
jul 17 01:00:24 anonymous-lap rclone[96758]: DEBUG : Creating backend with remo>
jul 17 01:00:24 anonymous-lap rclone[96758]: Enter configuration password:
jul 17 01:00:24 anonymous-lap rclone[96758]: password:Failed to read line: EOF
jul 17 01:00:24 anonymous-lap systemd[1]: rclonemount.service: Main process exi>
jul 17 01:00:24 anonymous-lap systemd[1]: rclonemount.service: Failed with resu>
jul 17 01:00:24 anonymous-lap systemd[1]: Failed to start RClone Service.

You need to set the variable in the systemd file, so something like

[Service]
....
Environment=RCLONE_CONFIG_PASS=xxxxx

Thanks for your answer.
But if I have to store the password in plaintext in the systemd file, then what is the point of having the cfg password protected? :slight_smile: :thinking:

So don't store it in plaintext, wrap it around something if that's your goal.

What problem are you trying to solve?

I am just trying to auto mount a remote from my config whenever i start my computer.
But I might just make a separate config for that one remote without a password since I don't know how to "wrap it around something else". :slight_smile:

Here is an example.

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