Closed alder711 closed 1 year ago
If my sleepy brain is not mistaken, the following happens:
testowner
testuser
do chown
and other ops on the file because it's not the owner, according to bindfs--chown-ignore
doesn't do what one might expect here because it doesn't ignore the permission check. (This may well change when I eventually have time to fix #120 by doing the permission check in bindfs instead of letting the kernel do it.)
Possible solution: use --mirror=@testgroup
instead of -u
Ah, ok, that is a subtle difference that I didn't think about.
The weird thing is, BindFS worked in a previous setup I had for group writable purposes with the command I mentioned above until now, even though I didn't change BindFS versions. Not sure what changed for this to "break" on me. I am now using --mirror=@testgroup
as you said, and it is working.
Thanks for all your hard work, @mpartel !
BindFS version:
1.17.2
I have a question regarding the behavior of BindFS when used with bind mounts into containers.
I run into the below issue when I try to set up a directory in a container that has group write permissions so that users who are not the owner of the directory can still create/modify/delete the contents of this directory. For this, I attempt to use the BindFS arguments
-p 0775 --create-with-perms=0775
.QUESTION: Why do
-p
and--create-with-perms
cause permission issues when a user is not the owner of a directory, but has group ownership?Currently, if I try to make a BindFS mount from one point on a host onto another point on that host and then bind mount that into a container, permissions issues seem to occur. In the below example,
testowner
owns the shared directory, while members oftestgroup
should have create/modify/delete access to the shared directory contents. This includes usertestuser
.Example of Issue
The output of BindFS here is:
And verify directory permissions:
host # ls -al /mnt total 8 drwxrwxr-x 2 testowner testgroup 4096 Apr 11 13:16 . drwxr-xr-x 20 root root 4096 Apr 11 00:43 ..
host # docker run -it --rm --name tester --volume /mnt:/mnt alpine:latest sh
container # addgroup -g 1003 testgroup container # adduser -u 1002 testuser container # addgroup testuser testgroup container # adduser -u 1004 testowner
container # su testuser -c 'mkdir ~/mydir; echo 'testdata' > ~/mydir/testfile'
container # su testuser -c 'mv ~/mydir /mnt/'
mv: can't preserve times of '/mnt/mydir/testfile': Operation not permitted mv: can't preserve ownership of '/mnt/mydir/testfile': Operation not permitted mv: can't preserve permissions of '/mnt/mydir/testfile': Operation not permitted mv: can't preserve permissions of '/mnt/mydir': Operation not permitted mv: can't preserve times of '/mnt/mydir': Operation not permitted mv: can't preserve ownership of '/mnt/mydir': Operation not permitted mv: can't preserve permissions of '/mnt/mydir': Operation not permitted
unique: 258, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 [137/866] getattr[NULL] / unique: 258, success, outsize: 120 unique: 260, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 260, success, outsize: 120 unique: 262, opcode: LOOKUP (1), nodeid: 1, insize: 46, pid: 28475 LOOKUP /mydir getattr[NULL] /mydir unique: 262, error: -2 (No such file or directory), outsize: 16 unique: 264, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 264, success, outsize: 120 unique: 266, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 266, success, outsize: 120 unique: 268, opcode: LOOKUP (1), nodeid: 1, insize: 46, pid: 28475 LOOKUP /mydir getattr[NULL] /mydir unique: 268, error: -2 (No such file or directory), outsize: 16 unique: 270, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 270, success, outsize: 120 unique: 272, opcode: LOOKUP (1), nodeid: 1, insize: 46, pid: 28475 LOOKUP /mydir getattr[NULL] /mydir unique: 272, error: -2 (No such file or directory), outsize: 16 unique: 274, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 274, success, outsize: 120 unique: 276, opcode: MKDIR (9), nodeid: 1, insize: 54, pid: 28475 mkdir /mydir 0755 umask=0000 getattr[NULL] /mydir NODEID: 6 unique: 276, success, outsize: 144 unique: 278, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 278, success, outsize: 120 unique: 280, opcode: LOOKUP (1), nodeid: 1, insize: 46, pid: 28475 LOOKUP /mydir getattr[NULL] /mydir NODEID: 6 unique: 280, success, outsize: 144 unique: 282, opcode: GETATTR (3), nodeid: 6, insize: 56, pid: 28475 getattr[NULL] /mydir unique: 282, success, outsize: 120 unique: 284, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 284, success, outsize: 120 unique: 286, opcode: LOOKUP (1), nodeid: 1, insize: 46, pid: 28475 LOOKUP /mydir getattr[NULL] /mydir NODEID: 6 unique: 286, success, outsize: 144 unique: 288, opcode: GETATTR (3), nodeid: 6, insize: 56, pid: 28475 getattr[NULL] /mydir unique: 288, success, outsize: 120 unique: 290, opcode: LOOKUP (1), nodeid: 6, insize: 49, pid: 28475 LOOKUP /mydir/testfile getattr[NULL] /mydir/testfile unique: 290, error: -2 (No such file or directory), outsize: 16 unique: 292, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 292, success, outsize: 120 unique: 294, opcode: LOOKUP (1), nodeid: 1, insize: 46, pid: 28475 LOOKUP /mydir getattr[NULL] /mydir NODEID: 6 unique: 294, success, outsize: 144 unique: 296, opcode: GETATTR (3), nodeid: 6, insize: 56, pid: 28475 getattr[NULL] /mydir unique: 296, success, outsize: 120 unique: 298, opcode: GETATTR (3), nodeid: 6, insize: 56, pid: 28475 getattr[NULL] /mydir unique: 298, success, outsize: 120 unique: 300, opcode: LOOKUP (1), nodeid: 6, insize: 49, pid: 28475 LOOKUP /mydir/testfile getattr[NULL] /mydir/testfile unique: 300, error: -2 (No such file or directory), outsize: 16 unique: 302, opcode: CREATE (35), nodeid: 6, insize: 65, pid: 28475 create flags: 0x80c1 /mydir/testfile 0100644 umask=0022 create[5] flags: 0x80c1 /mydir/testfile getattr[5] /mydir/testfile NODEID: 7 unique: 302, success, outsize: 160 unique: 304, opcode: GETATTR (3), nodeid: 7, insize: 56, pid: 28475 getattr[NULL] /mydir/testfile unique: 304, success, outsize: 120 unique: 306, opcode: GETXATTR (22), nodeid: 7, insize: 68, pid: 28475 getxattr /mydir/testfile security.capability 0 unique: 306, error: -61 (No data available), outsize: 16 unique: 308, opcode: WRITE (16), nodeid: 7, insize: 89, pid: 28475 write[5] 9 bytes to 0 flags: 0x8001 write[5] 9 bytes to 0 [44/866] unique: 308, success, outsize: 24 unique: 310, opcode: RELEASE (18), nodeid: 7, insize: 64, pid: 0 release[5] flags: 0x8001 unique: 310, success, outsize: 16 unique: 312, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 312, success, outsize: 120 unique: 314, opcode: LOOKUP (1), nodeid: 1, insize: 46, pid: 28475 LOOKUP /mydir getattr[NULL] /mydir NODEID: 6 unique: 314, success, outsize: 144 unique: 316, opcode: GETATTR (3), nodeid: 6, insize: 56, pid: 28475 getattr[NULL] /mydir unique: 316, success, outsize: 120 unique: 318, opcode: LOOKUP (1), nodeid: 6, insize: 49, pid: 28475 LOOKUP /mydir/testfile getattr[NULL] /mydir/testfile NODEID: 7 unique: 318, success, outsize: 144 unique: 320, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 320, success, outsize: 120 unique: 322, opcode: LOOKUP (1), nodeid: 1, insize: 46, pid: 28475 LOOKUP /mydir getattr[NULL] /mydir NODEID: 6 unique: 322, success, outsize: 144 unique: 324, opcode: GETATTR (3), nodeid: 6, insize: 56, pid: 28475 getattr[NULL] /mydir unique: 324, success, outsize: 120 unique: 326, opcode: LOOKUP (1), nodeid: 6, insize: 49, pid: 28475 LOOKUP /mydir/testfile getattr[NULL] /mydir/testfile NODEID: 7 unique: 326, success, outsize: 144 unique: 328, opcode: GETXATTR (22), nodeid: 7, insize: 68, pid: 28475 getxattr /mydir/testfile security.capability 0 unique: 328, error: -61 (No data available), outsize: 16 unique: 330, opcode: GETATTR (3), nodeid: 7, insize: 56, pid: 28475 getattr[NULL] /mydir/testfile unique: 330, success, outsize: 120 unique: 332, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 332, success, outsize: 120 unique: 334, opcode: LOOKUP (1), nodeid: 1, insize: 46, pid: 28475 LOOKUP /mydir getattr[NULL] /mydir NODEID: 6 unique: 334, success, outsize: 144 unique: 336, opcode: GETATTR (3), nodeid: 6, insize: 56, pid: 28475 getattr[NULL] /mydir unique: 336, success, outsize: 120 unique: 338, opcode: LOOKUP (1), nodeid: 6, insize: 49, pid: 28475 LOOKUP /mydir/testfile getattr[NULL] /mydir/testfile NODEID: 7 unique: 338, success, outsize: 144 unique: 340, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 340, success, outsize: 120 unique: 342, opcode: LOOKUP (1), nodeid: 1, insize: 46, pid: 28475 LOOKUP /mydir getattr[NULL] /mydir NODEID: 6 unique: 342, success, outsize: 144 unique: 344, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 344, success, outsize: 120 unique: 346, opcode: LOOKUP (1), nodeid: 1, insize: 46, pid: 28475 LOOKUP /mydir getattr[NULL] /mydir NODEID: 6 unique: 346, success, outsize: 144 unique: 348, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 348, success, outsize: 120 unique: 350, opcode: LOOKUP (1), nodeid: 1, insize: 46, pid: 28475 LOOKUP /mydir getattr[NULL] /mydir NODEID: 6 unique: 350, success, outsize: 144 unique: 352, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 28475 getattr[NULL] / unique: 352, success, outsize: 120 unique: 354, opcode: LOOKUP (1), nodeid: 1, insize: 46, pid: 28475 LOOKUP /mydir getattr[NULL] /mydir NODEID: 6 unique: 354, success, outsize: 144
mv: can't create directory '/mnt/mydir': Permission denied