Mount via systemd using wrong permissions

What is the problem you are having with rclone?

Mounting via systemd or via manual command result in different file/dir permissions. I'm setting up an automount unit in systemd (CentOS 7.9), the mount works but I'm unable to use the correct permissions.

I added --dir-perms=0770 --file-perms=0660, when I mount the path via systemd I get the following:

[root@gestionale system]# ls -la /mnt/nextcloud
total 4
drwxr-x--- 1 root domain users    0 nov 29 09:45 .
drwxr-xr-x 3 root root         4096 nov 29 09:29 ..
drwxr-x--- 1 root domain users    0 nov 28 13:42 gestionale-cl

If i run the rclone command found in ps manually from an interactive shell, I get the desired permissions:

[root@gestionale system]# ps faux | grep rclone
root      5618  3.7  0.0 761748 29040 ?        Sl   09:57   0:00 /usr/bin/rclone mount SLNextcloud: /mnt/nextcloud --vfs-cache-mode=writes --config=/dati/yetopen/rclone/.rclone.conf --cache-dir=/var/rclone --dir-perms=0770 --file-perms=0660 --gid=10513 --verbose=2 --daemon
[root@gestionale system]# /usr/bin/rclone mount SLNextcloud: /mnt/nextcloud --vfs-cache-mode=writes --config=/dati/yetopen/rclone/.rclone.conf --cache-dir=/var/rclone --dir-perms=0770 --file-perms=0660 --gid=10513 --verbose=2 --daemon
[root@gestionale system]# ls -la /mnt/nextcloud
total 4
drwxrwx--- 1 root domain users    0 nov 29 09:50 .
drwxr-xr-x 3 root root         4096 nov 29 09:29 ..
drwxrwx--- 1 root domain users    0 nov 28 13:42 gestionale-cl

mnt-nextcloud.mount content:

[Unit]
After=network-online.target
[Mount]
Type=rclone
What=SLNextcloud:
Where=/mnt/nextcloud
Options=rw,vv,vfs-cache-mode=writes,config=/dati/yetopen/rclone/.rclone.conf,cache-dir=/var/rclone,dir-perms=0770,file-perms=0660,gid=10513

mnt-nextcloud.automount content:

[Unit]
After=network-online.target
Before=remote-fs.target
[Automount]
Where=/mnt/nextcloud
TimeoutIdleSec=600
[Install]
WantedBy=multi-user.target

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

rclone v1.60.1
- os/version: centos 7.9.2009 (64 bit)
- os/kernel: 3.10.0-1160.76.1.el7.x86_64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.19.3
- go/linking: static
- go/tags: none

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

  • Nextcloud (Webdav)

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

/usr/bin/rclone mount SLNextcloud: /mnt/nextcloud --vfs-cache-mode=writes --config=/dati/yetopen/rclone/.rclone.conf --cache-dir=/var/rclone --dir-perms=0770 --file-perms=0660 --gid=10513 --daemon

The rclone config contents with secrets removed.

[SLNextcloud]
type = webdav
url = https://nextcloud.domain.it/remote.php/webdav/
vendor = nextcloud
user = srv
pass = xxxxxx

A log from the command with the -vv flag

nov 29 09:45:49 gestionale.domain.it mount[2635]: 2022/11/29 09:45:49 DEBUG : rclone: Version "v1.60.1" starting with parameters ["/sbin/mount.rclone" "mount" "SLNextcloud:" "/mnt/nextcloud" "--vfs-cache-mode=writes" "--config=/dati/yetopen/rclone/.rclone.conf" "--cache-dir=/var/rclone" "--dir-perms=0770" "--file-perms=0660" "--gid=10513" "--verbose=2" "--daemon"]
nov 29 09:45:49 gestionale.domain.it mount[2635]: 2022/11/29 09:45:49 DEBUG : Using fallback PATH to run fusermount
nov 29 09:45:49 gestionale.domain.it mount[2635]: 2022/11/29 09:45:49 DEBUG : Creating backend with remote "SLNextcloud:"
nov 29 09:45:49 gestionale.domain.it mount[2635]: 2022/11/29 09:45:49 DEBUG : Using config file from "/dati/yetopen/rclone/.rclone.conf"
nov 29 09:45:49 gestionale.domain.it mount[2635]: 2022/11/29 09:45:49 DEBUG : found headers:
nov 29 09:45:49 gestionale.domain.it systemd[1]: Mounted /mnt/nextcloud.
nov 29 09:45:49 gestionale.domain.it mount[2635]: 2022/11/29 09:45:49 DEBUG : rclone: Version "v1.60.1" finishing with parameters ["/usr/bin/rclone" "mount" "SLNextcloud:" "/mnt/nextcloud" "--vfs-cache-mode=writes" "--config=/dati/yetopen/rclone/.rclone.conf" "--cache-dir=/var/rclone" "--dir-perms=0770" "--file-perms=0660" "--gid=10513" "--verbose=2" "--daemon"]

What is your umask?

Try adding --umask 0777

Wow, super fast! Indeed that was the option, but rather different! Adding umask=0007 to the mount options worked! Thank you!!

I don't know if it's an rclone-related question or not, but why this overlap between umask and {dir|file}-perms?

Ah yes, I always forget how umask works!

If you open your shell and type umask you'll see your shell process has a default umask. Rclone is trying to obey this which is what well behaved unix programs should do.

It might be that rclone shouldn't obey the umask, or maybe give a warning if you set --dir-perms or --file-perms manually and bits are being masked from them.

1 Like

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