containers / containers/fuse-overlayfs

Permission denied when changing permissions on a directory mounted and squashed

Open
#374 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
691
Forks
109
Avg merge
5d 7h
Merged PRs (30d)
2

Description

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?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the unprivileged fuse-overlayfs command using the lowerdir, upperdir, workdir, squash_to_uid, and squash_to_gid options shown in the report. Trace the permission-changing path for mounted/foo and determine whether the requested ownership and chmod behavior is supported; done means the behavior is fixed or clearly documented.

Written by the indexing model from the issue text.

Assessment

Domain
operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.