Sunday, April 28, 2024
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 5206  / 1 Year ago, wed, february 1, 2023, 4:24:20

I have a folder in my home directory that I want to be truly shared between all users on the same computer.



So, I set the permission to be 777. Now, all users can access it and can create, ,edit, delete files in it.



However, I do not have write access to files created by other users.



How do I ensure that all files (existing as well as newly created/ copied) have rwx access to all users?


More From » file-sharing

 Answers
7

I suggest you use bindfs.



bindfs allow multiple local users to read and write (create, delete, rename, modify...) all files (including newly created ones) from a shared directory and its subdirectories.



You can specify users by user name or group, it is very flexible.



The basic syntax (from the wiki page) is:




  • Creating the shared directory



e.g. in the /home directory:



sudo mkdir /home/shared


NOTE: If the directory already exist skip this step.



Allow only root to access it, we will set the permissions later with bindfs:



sudo chown root: /home/shared
sudo chmod 0700 /home/shared



  • Setting the permissions with bindfs



Now use the bindfs command to mount the shared directory with altered permissions. Syntax of the command:



bindfs [options] dir mountpoint


Example:



sudo bindfs -o perms=0700,mirror-only=user1:user2:user3 /home/shared /home/shared



  • Options explained:



perms=0700 sets the permissions to 0700 (read/write for the owner, none for the group and other)



mirror-only=user1:user2:user3 user1, user2 and user3 will see itself as the owner of the files (user names are separated by a colon).



To automatically mount at boot, use fstab . Open fstab for editing with sudo nano /etc/fstab and add a line




  • fstab example:



bindfs#/home/shared /home/shared fuse perms=0700,mirror-only=user1:user2:user3 0 0



See - Ubuntu wiki bindfs for group options and additional details.


[#37140] Friday, February 3, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
utonmbo

Total Points: 134
Total Questions: 104
Total Answers: 118

Location: Argentina
Member since Mon, Jan 3, 2022
2 Years ago
;