Rclone mount with specific umask just for the mount, not for all files

What is the problem you are having with rclone?

I am using rclone mount with Wasabi and Nextcloud on Ubuntu 20.04. Nextcloud wants 770 for the mount (/mnt/nextcloud), but different permissions (and Nextcloud determined permissions) for the files and subdirs below the mount. I've tried --dir-perms 775 and --files-perms 664, didn't work. I've tried umask 0077 but all files become 0077. Mounting wasabi:bucket/folder

Not concerned about UID and GID.

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

*Yes*

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

Wasabi
Using rclone copy/sync works perfectly on other buckets, but other buckets not being mounted.

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

rclone mount wasabi:thisisbenwoo-nc /mnt/nextcloud --vfs-cache-mode=full --vfs-case-insensitive=false --write-back-cache --dir-perms=0775 --file-perms=0664 --allow-other --daemon --log-file=/home/bwoo/rclone.log

Also tried without --write-back-cache --dir-perms=0775 --file-perms=0664 and also with ---allow-root

The rclone config contents with secrets removed.

[wasabi]
type = s3
provider = Wasabi
env_auth = false
access_key_id = [key id]
secret_access_key = [access key]
region = us-west-1
endpoint = s3.us-west-1.wasabisys.com
location_constraint =
acl =
server_side_encryption =
storage_class =

A log from the command with the -vv flag

2022/02/24 21:02:12 DEBUG : : Statfs:
2022/02/24 21:02:12 DEBUG : : >Statfs: stat={Blocks:274877906944 Bfree:274877906944 Bavail:274877906944 Files:1000000000 Ffree:1000000000 Bsize:4096 Namelen:255 Frsize:4096}, err=<nil>
---repeats above EXACTLY multiple times---
2022/02/24 21:03:24 DEBUG : /mnt/nextcloud: Unmounted externally. Just exit now.
2022/02/24 21:03:24 DEBUG : rclone: Version "v1.57.0" finishing with parameters ["/usr/bin/rclone" "mount" "wasabi:[bucket]" "/mnt/nextcloud" "--vfs-cache-mode=full" "--vfs-case-insensitive=false" "--write-back-cache" "--dir-perms=0775" "--file-perms=0664" "--allow-other" "--daemon" "--log-file=/home/[user]/rclone.log" "-vv"]

The repeat above just goes on and on.

Thanks in advance

Rclone has one set of permissions for directories, and one for files in rclone mount. That includes the root. It doesn't preserve permissions set by applications though it doesn't error if applications do try to set permissions.

Try --dir-perms 770 and --file-perms 660 and set the --uid and --gid to the same ones nextcloud is using.

Nick, thanks for the very fast response.

Before the mount, using ls -l:

drwxrwx--- 2 www-data www-data 4.0K Feb 24 07:24 nextcloud/

I did as you suggested. Here is the command I used:

sudo rclone mount wasabi:[bucket] /mnt/nextcloud --vfs-cache-mode=full --vfs-case-insensitive=false --dir-perms=0770 --file-perms=0660 --uid=33 --gid=33

I performed another ls -l after the command:

drwxr-x--- 1 www-data www-data 0 Feb 26 00:01 nextcloud/

So somehow, the mounted dir has the right uid/gid, but the group permissions are not following the --dir-perms=0770 directive (btw, I also tried --dir-perms=770 with the same result.

What do you want the permissions to be?

--umask should be it.

rclone mount DB: /home/felix/test --umask 000
felix@gemini:~/test$ ls -al hosts
-rw-rw-rw- 1 felix felix 184 Feb 12 14:00 hosts

or

rclone mount DB: /home/felix/test --umask 002
felix@gemini:~/test$ ls -al hosts
-rw-rw-r-- 1 felix felix 184 Feb 12 14:00 hosts

as a few examples.

What do you want the directory/file permissions to look like?

The permissions should be
drwxrwx--- for /mnt/nextcloud

and for directories under /mnt/nextcloud
drwxrwxr-x
and for files under /mnt/nextcloud
rw-rw-r--

Is that the mount point? You'd just chmod that to what you want it to be.

That's umask 002 in my example.

Animosity022,

Thank you! In my experimentation, I used --umask incorrectly.
I used umask=0022. I also omitted the --dir-perms and ---file-perms thinking that by not specifying, it would maintain the subdir and file permissions. I appreciate your assistance.

So, using your advice, my command is now:
sudo rclone mount wasabi:[bucket] /mnt/nextcloud --vfs-cache-mode=full --vfs-case-insensitive=false --dir-perms=770 --file-perms=0664 --umask=002 --uid=33 --gid=33

... and I do a ls -l in the /mnt directory, it gives me the desired result:
drwxrwx--- 1 www-data www-data 0 Feb 26 03:04 nextcloud
which is the desired perms, and in the subdirs:
drwxrwx--- 1 www-data www-data 0 Feb 26 03:04 [subdir]/
and the files have the desired perms also:
-rw-rw-r-- 1 www-data www-data 0 Jan 13 09:22 [file]

Thank you once more!

1 Like

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