Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied when changing permissions on a directory mounted and squashed #374

Open
akiross opened this issue Sep 16, 2022 · 0 comments

Comments

@akiross
Copy link

akiross commented Sep 16, 2022

Hello,

I would like to mount, as a regular user (not in a namespace or mapped uid/gid), a directory normally owned by root and have it writable, but also changing the owner to my regular user as well. I thought -o squash_to_uid=myuid was about to do the trick, but it didnt:

mkdir upper work mounted
fuse-overlayfs \
    -o lowerdir=/opt/foobar \
    -o upperdir=$PWD/upper \
    -o workdir=$PWD/work \
    -o squash_to_uid=`id -u` \
    -o squash_to_gid=`id -g` \
    mounted

The mounted is owned by me and I can write to it, but I cannot change ownership:

$ touch mounted/test
$ ls -l mounted
-r-xr-xr-x akiross akiross foo
-r-xr-xr-x akiross akiross test
-rwxrwx akiross akiross test

$ chmod 755 mounted/foo
chmod: changing permissions of 'mounted/foo': Permission denied

I thought overlayfs would save file metadata, and modifications to files, in the upper directory, so what I'm trying to do sounds legit, but I might be missing something.

Is it possible to achieve this with unprivileged user?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant