5 ms·
Anecdotally, my laptop is being used by two users. It irks very much that neither Ubuntu nor Fedora can easily support a common directory for data to be shared
by Iolaum 7y ago
Anecdotally, my laptop is being used by two users. It irks very much that neither Ubuntu nor Fedora can easily support a common directory for data to be shared between users. I ve created custom bash commands to fix group file ownership and similar issues arising from sharing a directory between two home users.
- grosswait 7y agoHave you looked into ACLs and/or setgid with a shared group? Used to do this at work all the time for numerous groups of users. This is definitely possible. You may need to pay attention to your umask.
- Iolaum 7y agoI have not looked at ACLs. They look too complex. Setgid works on file copy but not on file move. Not sure about umask.
- beagle3 7y agoWell, move on ext4 (and most other Linux filesystems) has very specific semantics - keep the file intact in every possible way (including permissions, modification time, ownership etc) but make it visible through another name. Please be aware that that the common semantics are that permissions are associated with a file, not with its name (and a file may have a lot of names through hard links, or no name at all - open a file, delete it, and it is only accessible if you have an fd, or with little more work through the inode number)
- Iolaum 7y agoI am indeed on ext4 (and MATE DE). Thank you for the information, although I am not sure what's the next step to have the OS enforce a certain group (and 775 permissions optimally) on all files created/copied/moved (moved is the part that's the biggest pain) within a certain directory.
- beagle3 7y agoYou can write a script that does "inotify_wait" on your directory and changes the permission on anything that's there and doesn't have them.
- em-bee 7y agoa share command that does the necessary permission changes (and optionally the move) would be nice. effectively you want to be able to say: share this file with joe, or share -rw joe john ... file ... destination/; something along those lines that will change the acl as needed.
- fuzzfactor 7y agoYou should be able to share a FAT32 partition without overwhelming permission problems. Not much differently than sharing a USB volume.
- shrubble 7y agoIt should be easy to do this? Create a group, place the two users in that group, create a directory and setgid it to the group.
- Iolaum 7y agoThat works when copying but not when moving files. For the latter case you need to manually edit those properties.
- aruggirello 7y agoJust setup a third user ("adduser [--disabled-login] user3", then share his home directory: make both users members of the third user's main group "adduser user1 user3 && adduser user2 user3" (assuming you don't want to alter both user's main groups for privacy), then "chmod g+wx /home/user3" and have a cron job enforcing all files in the shared directory belong to the user3 user/group and are writable by the group "* * * * * root chown -r user3:user3 /home/user3 [possibly add: && false || chmod -r g+w /home/user3]". Then create (soft|hard) links to the third user's home dir if you like. This way you retain each user's privacy, since main groups aren't changed, don't need to run custom scripts each time, and don't have multiple copies of the shared files. The only (IMHO minor) issue would be that newly shared files might only be accessible for the other user 30s later on average, and 1 minute at most. The cron job might be converted into a daemon monitoring new files appearing in /home/user3, but that is left as an exercise for the reader :)
- matja 7y agoYou don't need to use groups since ACLs: setfacl -R \ -m d:u:user1:rwx -m u:user1:rwx \ -m d:u:user2:rwx -m u:user2:rwx \ /home/shared d:u: sets the default user ACL for future directory entries u: sets the current user ACL for existing directory entries -R sets the ACLs recursively on existing files