Stack Overflow for Teams is a private, secure spot for you and
your coworkers to find and share information.
Learn more
I am new to fuse. I have mounted fuse by the following command.
/mnt/fuse -o default_permissions -o allow_other -o nonempty -o hard_remove –d
Now If I login as "test" user and tried to create a file called "testfile".
test@11540302:/registration> touch testfile
touch: setting times of `testfile': Permission denied
Strace output:
uname({sys="Linux", node="11540302", ...}) = 0
brk(0) = 0x8055000
brk(0x8076000) = 0x8076000
open("testfile", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_LARGEFILE, 0666) = 3
dup2(3, 0) = 0
close(3) = 0
utimensat(0, NULL, NULL, 0) = -1 EACCES (Permission denied)
close(0) = 0
But "testfile" creation is successful with owner as root user,
-rw-r--r-- 1 root trusted 0 Jan 19 13:51 testfile
I can understand that fuse application is running in root level, file creation happened with the owner as root. Because of that test user cannot perform any operation on "testfile".
My question:
Since I have given "allow_other" while mounting, why test user cannot having privileges to access the "testfile"?
Please correct me if my understanding is wrong.
–
–
Detailed explanation for this issue.
Solution:
As @dirkt said we need to handle permissions on our own.
Code to get the caller uid and gid:
fuse_get_context()->uid;
fuse_get_context()->gid;
Get the caller user id and group id and set the ownership of the file/directory while creating via fuse API's.
Always there is room for improvement. Kindly correct me if I am not correct.
Thank you dirkt for your explanation.
Also, make sure that #user_allow_other is uncommented on the fuse configuration file (generally on /etc/fuse.conf):
sed -i -e "s/#user_allow_other/user_allow_other/gi" /etc/fuse.conf
After running either of those, reboot the computer and try again.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.