Commands for Group Management
Second Part:
Now we will see about group admin tasks
We will create 5 users(user1, user2, user3, user4, user5) & 1 group(itbd-group)
[root@itbd ~]# useradd user1
[root@itbd ~]# useradd user2
[root@itbd ~]# useradd user3
[root@itbd ~]# useradd user4
[root@itbd ~]# useradd user5
[root@itbd ~]# tail -n 5 /etc/passwd
[root@itbd ~]# groupadd itbd-group
[root@itbd ~]# grep itbd-group /etc/group
Now, we will make user1 as an admin of itbd-group, so that user1 can add or remove other users into/from itbd-group. Until make as admin of a group, except root user, any user can not add/remove users of a group.Before making admin user1, he will not be able to add/remove any users to/from a group.See below
When we create a group, by default no admin is here of this group.
Very important things are - our any group's password information, admin info are kept in gshadow file.See below image
Now, we will make 'user1' as an admin of "itbd-group".
[root@itbd ~]# gpasswd -A user1 itbd-group
Now, if we login as user1, user1 will be able to add/remove any user to/from group.Let's see.
[root@itbd ~]# su - user1
[user1@itbd ~]$ gpasswd -a user2 itbd-group ; [adding user - user2 by group admin user1]
[user1@itbd ~]$ gpasswd -d user2 itbd-group ; [removing user - user2 by group admin]
Now, we will discuss about " login into group"
I will switch into "user1" account. and see his id. By default - user1 is a group member of user1.
Here, we are seeing the group id of "user1" account is "user1"
Now, user1 will login into group.But here are some issues.
.............................................................................................................................................................
If group has no password:
users(not member) without password - not be able to login into group
users(not member) with password - not be able to login into group
users(member) without password - able to login into group
users(member) with password - able to login into group
If group has password:
users(not member) without password - able to login into group with group password
users(not member) with password - able to login into group with group password
users(member) without password - able to login into group
users(member) with password - able to login into group
.............................................................................................................................................................
In a nutshell we can say,
If users (with password/without password) are members of a group -
They will be able to login into group without prompting password
If users (with password) are not members of a group -
They will be able to login into group without prompting password
If users (without password) are not members of a group -
They will be not to able to login into group without prompting password
Red Prism Group is one of the best Data Science coaching in Noida, offering services from training to placement as part of the Data Science training program.
ReplyDelete