Linux Lite Forums

Hardware - Support => Hard Drives and SSDs => Topic started by: Sprintrdriver on May 02, 2018, 05:12:51 PM

Title: Two users access to common folder
Post by: Sprintrdriver on May 02, 2018, 05:12:51 PM
Hi forum.

I have this situation where I have two users on the computer. I have tried to read up on users and groups to understand, but is still very new to this (most of what I have done so far is by googling to find solutions, and I have not this in my fingertips so to speak).

When I installed LL, I left a partition (last half of disk space, ext4) for it self for general file store.

Now I have made a folder, say it's named "everybody", it is supposed to hold files that both users have access to. Both users should be able to edit and delete whatever file the other user have created.

First off what I have done is to create a group "commonfiles" and put user1 and user2 in that group. Then I made permission to folder "everybody" so that it had group "commonfiles" with all permission. user1 is the owner of "everybody" folder.

What I discovered next - a thing that I didn't want to happen. If I create a new sub folder logged in as user1, that folder got permission that owner/group of "user1". So when I log on as user2 and navigate into the same folder, user2 cannot edit/delete any files, unless user1 spesific say that the newly created folder should have group commonfiles instead of user1.

The question I have to make life easier: Should I just forget about having this group called "commonfiles" and instead just make user2 into group "user1"? That is - what benefits / caveats should I expect if I does that?
Title: Re: Two users access to common folder
Post by: Scott on May 02, 2018, 05:48:31 PM
Hi Sprintdriver

Quote
When I installed LL, I left a partition (last half of disk space, ext4) for it self for general file store.

One possible solution is to format the partition mentioned above with the FAT file system.
Title: Re: Two users access to common folder
Post by: trinidad on May 02, 2018, 07:02:09 PM
User permissions have OS implications. You're trying to use a partition like a db which you cannot configure how you want without either actually making it a db, or adding the partition back to the OS the users are on so that the user settings you want to use apply. The partition is clear of the OS now so either add it back in or use a db manager.

TC
Title: Re: Two users access to common folder
Post by: Sprintrdriver on May 03, 2018, 06:28:25 PM
Thanks for answers.

First off - just an addition to my first post: What I does is I tries to use two separate users (both is actually me as I'm the only physical user of the laptop) where user2 is the one that deals with sensitive files (passwords, etc...), as an alternative to using temporary encryption such as Veracrypt. So far it seems to be the way to go, but I need to be able to put some files to a common location so both users can access, regardless which user have created the file or folder.

@Scott - fat is not the right thing for me as I think it is a nice thing to be able to restrict access of some users but not all. And with fat I won't be able to save very large files.

@trinidad - I'm not into databases so I'm not sure where that answer leads to. Why should I want to convert it into a database?
Title: Re: Two users access to common folder
Post by: trinidad on May 04, 2018, 11:46:40 AM
Again to clarify: You say you installed your LL OS to one partition and left another separate partition for file storage. When a user writes a file to that partition and saves it there those permissions apply. Another user must have the same permissions, however when mounted the extra partition has its own permissions which match whatever permissions it's previous user applied plus whatever was applied during install. Ext 4 is a journaling file system. You have three owners in effect, root, user1, and user 2. Root owns BOTH ext4 partitions and your OS file system (per your installation) It's not going to perform the way you want, the way you are trying to set it up. *Fat 32 with a storage flag would work for you depending on the file extensions and what you are doing with them. It's really kind of pointless to have the extra ext4 partition and not manage it as a db, especially if you want to share files between users.

"What I does is I tries to use two separate users (both is actually me as I'm the only physical user of the laptop) where user2 is the one that deals with sensitive files (passwords, etc...), as an alternative to using temporary encryption such as Veracrypt."

Hard to understand the point of this for an everyday LL user.

TC     
Title: Re: Two users access to common folder
Post by: Scott on May 04, 2018, 12:04:41 PM

@trinidad

I happen to agree that FAT32 will probably be the good choice here but Sprintrdriver mentioned in reply #3 that file size is a concern. Do you have experience with exFAT filesystem? I know that would solve the issue of max file size but how about his permissions concern? I believe in LL 3.X/(ubuntu 16.04) it needs to be installed separately (packages exfat-fuse, exfat-utils) but I'm not sure about this.
Title: Re: Two users access to common folder
Post by: Sprintrdriver on January 21, 2019, 11:01:07 AM
Hope it's ok that I update this old thread - I doesn't want to be rude and not giving credits for those answering me.

I have make a very dumb thing here. When I wrote this post, I had LL 3.6 installed, and I know for sure I got it right. Then I wiped everything exept partition order when installing LL 4.2 - But stupid as I was, I forgot to write down what I did (lost Terminal history)

The annoying part is that I managed to wrote down the one thing that didn't work as I wanted.
sudo setfacl -m

This command, when specifying group and directory, turned out to only be effective to that specific folder, and not the directory structure below (i.e. not recursive).
But I know it's close, because I know the next thing I did, worked - i.e. made a directory having full privilegies for two users for every existing file and new files.
Title: Re: Two users access to common folder
Post by: Sprintrdriver on February 16, 2019, 05:34:38 PM
Hi again. I just find my notes from back then - so I figured to share that.

STEP 1 - Get an overview over groups
cat /etc/group
 (I don't recall if I had to put user2 into same group as user1)

STEP 2 - Use chgrp to change group ownership of that folder.

STEP 3 - use chmod recursively
sudo chmod -R 2775 /storagefolder/