LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   File Permissions between users (https://www.linuxquestions.org/questions/linux-newbie-8/file-permissions-between-users-4175543267/)

IammenotyoU 05-21-2015 06:06 PM

File Permissions between users
 
Hello Everyone! I'm somewhat new to linux, and getting my feet wet by building my first linux server. :)

So what i have is an application that moves/sorts files. Another program that catalogs them.

The problem is that each app uses it's own user. So my question is if there is any way that files owned by prog1user can be read by prog2user?

I have tried doing a chmod -R 755 Directory and that has allowed the second program to see the files, but I'm guessing this has certain security risks (although I'm not so worried about the files in this directory).

Anyways I was wondering if there was a proper way to do this? OS is debian wheezy.

Cheers!

Keith Hedger 05-21-2015 06:14 PM

If one of the usrs only needs read permissions for the files just add that user to the user group of the girst user, that isn't as complicated as it sounds!

IammenotyoU 05-22-2015 08:59 AM

That doesn't appear to work :(

The directories are created:
drwxr-sr-x vbox user DirName

all the files within appear as such:
-rw-r--r-- 1 vbox users FileName

so I checked /etc/group |grep vbox and see:
vboxusers:x:115:user1,user2,vbox
sortgroup:x:1001:user2,vbox,user1

so user1 (my user) and user2 (cataloging app) account are in the same groups as vbox user. :)

So after the sorting is done, the file permission have changed to:

-rw-rw---- 1 vbox users FileName

So this is where I don't understand.
My user (user1) and user2 can see the files, can not delete them. -OK
However, the cataloging app, run under the user2 account can not see the files.

So this is when I do a chmod 755 FileName, and catalog app picks it up immediately.

suicidaleggroll 05-22-2015 09:35 AM

Quote:

Originally Posted by IammenotyoU (Post 5366007)
so user1 (my user) and user2 (cataloging app) account are in the same groups as vbox user. :)

That's not how it works. Files/dirs belong to a user and a group, and they have separate permissions for the owner, group members, and everyone else. The owner gets the owner's permissions, any user who is a member of the group gets the group's permissions, and everyone else gets the "other" permissions.

Two users being a part of the same group means nothing, except that both users will have group access to files belonging to that group. In this case, the files in question are in the "users" group, so any user that you want to have group access needs to also be a member of the "users" group.


All times are GMT -5. The time now is 10:44 PM.