LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Groups..Users..Permissions.. (https://www.linuxquestions.org/questions/linux-newbie-8/groups-users-permissions-706828/)

kapilbajpai88 02-23-2009 09:02 AM

Groups..Users..Permissions..
 
Hi All,

Could anybody please let me know about the below simple but confusing question :
"There are 3 groups(say abc, xyz and ijk) and there are four users (say u1, u2, u3 and u4). How to assign 1 user to each group?? How can we configure users and groups so that usres of groups abc and efg only can access each others data ?? Finally, how to configure the fourth user in such a manner that he can access the files of all the other users??"

It is slight confusing for me , and I got different errors while trying to attempt this....

Thank You in advance..
Kapil

gergely89 02-23-2009 09:36 AM

Each user is also a group. Users can share groups, by adding the user to the group of another user. A separate definition of groups is possible, but not necessary.

The Linux Documentation Project (http://tldp.org) has good material on generic UNIX and Linux concepts for system administrators. Or see the man files for useradd (or adduser on some systems) and groupadd.

linux

adnankhawer 02-23-2009 10:11 AM

Quote:

How to assign 1 user to each group??
open /etc/group file

abc:x:604:u1

you can add more by separating with , u1,u2,u3. 604 is group ID which can be different.

Quote:

How can we configure users and groups so that usres of groups abc and efg only can access each others data ??
for this purpose
1. you have to make another group then assign the users of abcand efg to that group.
2.then make a shared directory (say /home/shareit) for new shared group (say mygrp)
3. change ownership so that only new group members can access this directory.

#chown nobody.mygrp /home/shareit

4. change permission bits
#chmod 770 /home/shareit
5. set SGID bit

#chmod g+s /home/shareit

I think it will work!

Bye

kapilbajpai88 02-23-2009 10:36 AM

Hi Adnankhawer,

This information is really helpful, but I am getting a little confused. Let me tell you what I did till now :
a) created three groups using groupadd command
b) created four users using useradd command
c) assign 1 user to each group using command 'usermod -G abc u1'...respec
d) assign users u1 and u2, to same group say group xyz, using same command.
e) while I tried accessing files, I got 'permission denied' error. So I changed permission to users to 770 and files within users to 660.
Now I can access files of users u1 and u2 as they belong to same group.

But still, I am facing problems in creating another user u4 who can access all the files of all the users.
Also, I didn't tried adding users to same group directly from /etc/group file. I will try that, as it seems easy and quick way of doing this.
Also could you please explain this additional directory concept ???

Thank you,
Kapil


Quote:

Originally Posted by adnankhawer (Post 3454471)
open /etc/group file

abc:x:604:u1

you can add more by separating with , u1,u2,u3. 604 is group ID which can be different.



for this purpose
1. you have to make another group then assign the users of abcand efg to that group.
2.then make a shared directory (say /home/shareit) for new shared group (say mygrp)
3. change ownership so that only new group members can access this directory.

#chown nobody.mygrp /home/shareit

4. change permission bits
#chmod 770 /home/shareit
5. set SGID bit

#chmod g+s /home/shareit

I think it will work!

Bye


kapilbajpai88 02-23-2009 10:41 AM

Hi gergely89,

Thank You for your reply, but sorry to say that I didn't get anything from your reply. I am not so through with Linux till now, although I am trying hard to do so.
Could you please explain in somewhat more detail, what you were trying in your last reply....

Thank You again..
Kapil.


Quote:

Originally Posted by gergely89 (Post 3454419)
Each user is also a group. Users can share groups, by adding the user to the group of another user. A separate definition of groups is possible, but not necessary.

The Linux Documentation Project (http://tldp.org) has good material on generic UNIX and Linux concepts for system administrators. Or see the man files for useradd (or adduser on some systems) and groupadd.


pixellany 02-23-2009 10:59 AM

I am not following the details of this, but my sense is that you may be confusing yourself. For example, it makes no sense to have a group with one user.

First, decide the broadest privileges you want to have---this gets assigned to "others" (the third column of permissions).

Second, decide the permissions for the group that is assigned to the file or directory. Anyone who needs those permissions can be added to that group.

Finally, the highest level of permissions typicall go the owner of the file (directory)

I think you can do fancier stuff by creating soft links, but first be sure you are clear on the basics.

kapilbajpai88 02-23-2009 11:08 AM

Hi pixellany,

Actually, I am supposed to try this with 16 users and 3 groups. But on my machine, i want to try this with few users and same three 3 groups.
maybe I might be confusing myself, but I really want to figure this out asap. Any clear suggestion will be more than helpful.

Thank You,
Kapil.


Quote:

Originally Posted by pixellany (Post 3454524)
I am not following the details of this, but my sense is that you may be confusing yourself. For example, it makes no sense to have a group with one user.

First, decide the broadest privileges you want to have---this gets assigned to "others" (the third column of permissions).

Second, decide the permissions for the group that is assigned to the file or directory. Anyone who needs those permissions can be added to that group.

Finally, the highest level of permissions typicall go the owner of the file (directory)

I think you can do fancier stuff by creating soft links, but first be sure you are clear on the basics.


adnankhawer 02-23-2009 11:20 AM

Hi Kapil,

Let me tell u what I know about users and groups;

Each user has its own file/directories no user can access files/Dir of other user even if it belongs to same goup. you have to assign permission to user for access to other files/dir; try

#man chown

#man chmod and find sticky bit help on directory, as i wrote chmod g+s /.../...

Quote:

I am facing problems in creating another user u4 who can access all the files of all the users.
for this purpose, I will try or ask to Linux Gurus they are most respected persons in Linux Community!!!!!!!!!

Bye

pixellany 02-23-2009 02:57 PM

Quote:

Originally Posted by kapilbajpai88 (Post 3454534)
Actually, I am supposed to try this with 16 users and 3 groups.

Homework?


All times are GMT -5. The time now is 12:19 AM.