LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   [Confusion] File Security (http://www.linuxquestions.org/questions/linux-newbie-8/%5Bconfusion%5D-file-security-718140/)

Fracker 04-10-2009 02:50 AM

[Confusion] File Security
 
Hi,

I have a confusion, let suppose there is a file, i want to give rwx rights to two users "User_A", & "User_B", "User_A" Belongs to "Group_A", & "User_B" Belongs to "Group_B". Now there are other users as well who belong to Group_A, & Group_B, how can it be done? Create another Group and set group rights? but i guess then if there are 1000s of files then i have to create that much groups?

Ps: I don't want file security management through GUI file manager.

Vit77 04-10-2009 04:31 AM

Hi Fracker,

If you want several users to have similar access rights to a file(s), there's a group is for. You're right.

So, you may have to create new group (say, GROUP2) and use find command to change all files in some specified dir to a new group.

Code:

find /path-to-your-files -group GROUP1 -exec chgrp GROUP2 {} \;
Is it possible to use this way with your files?

Fracker 04-10-2009 11:45 PM

@Vit77

I already mentioned this make no sense, let say i have file server, which contain 1000s files, and i have around 1000 users who access those files, some people want to give rights to some users some don't & even more complex scenario, some people want to give read access to one user, write access to other user, while no delete access. Like in windows it is not a big deal, but when i come to linux it become v hard to do so, yes i can use always some content management tools or so, but why can i do it in linux environment.

reptiler 04-11-2009 12:59 AM

I guess ACLs might help here.
There you can specify several users and/or groups to have access to a file, not just one each, as is the case without ACLs.

Let me give you an example.
Let's say I have a file called MyFile, which is stored in a publicly accessible location.
I want only to grant access to myself and one other user (let's call the user sue).
So what I can do here is simply run setfacl -m u:sue:rwx MyFile and in addition to myself sue now has full access to the file, but nobody else (given that the "regular" permissions are set accordingly).

Fracker 04-12-2009 11:32 PM

Thanks reptiler

reptiler 04-13-2009 11:46 PM

You're welcome.


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