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

bugfix: preserve effective uid and gid for new files #5

Merged
merged 1 commit into from
Dec 3, 2021
Merged

bugfix: preserve effective uid and gid for new files #5

merged 1 commit into from
Dec 3, 2021

Conversation

rr-
Copy link
Contributor

@rr- rr- commented Mar 16, 2018

@rr-
Copy link
Contributor Author

rr- commented Mar 16, 2018

Of course, this solution will fail to lchown anything if the mount user isn't root, but same happens with sshfs:

user@localhost:~$ sshfs -o allow_other example.com: ~/test/
user@localhost:~$ touch ~/test/a
user@localhost:~$ sudo touch ~/test/b
user@localhost:~$ sudo ls ~/test/{a,b}
-rw-r--r-- 1 user user      0 Jan  1  1970 a
-rw-r--r-- 1 user user      0 Jan  1  1970 b

What matters is when things happen the other way: the directory is mounted under root (for example through /etc/fstab) and an ordinary user tries to create a file within the mounted directory. This ensures the file will belong to the user rather than root.

This solution doesn't support idmaps.

@fbarriga
Copy link
Owner

fbarriga commented Dec 3, 2021

thanks!

@fbarriga fbarriga merged commit 0563d8e into fbarriga:master Dec 3, 2021
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

Successfully merging this pull request may close these issues.

File ownership anomalies
2 participants