Tech Junkie Blog - Real World Tutorials, Happy Coding!: Linux CentOS In-Depth: Creating and Adding Users to The developers Group

Thursday, September 16, 2021

Linux CentOS In-Depth: Creating and Adding Users to The developers Group

In the previous post we created a user called "John Wallace", in this post we are going to add John and Jason into the developers group.  In any system you want to group users into groups so that you can easily assign constraints and privileges to a group of user instead of doing it one at a time.

To create a group call developers type in the following command:

  1. su to get root access
  2. groupadd developers to add the group developers 

3.  Now we want to assign John and Jason to the developers group, with this command useradd john -G developers and repeat the command with jason

As you can see we used the usermod command instead of the useradd command because john, and jason already exists.

4.  Now let's assign a group to the user on creation using the useradd command useradd -s /bin/bash -d /home/dora -m dora -G developers 

In the command above we added a new user called dora and assigned her to developers group at the same time.  The -G option indicates that we want to assign a default group to the user.

5.  Now to verify we are going to list the members of the developers group with this command grep 'developers' /etc/group this command searches for entry for the developers group in the /etc/group file

6.  Now let's say John is a bad developer and always brings down the server with his infinite loops.  We can use this command to remove John from the developers group gpasswd -d john developers

1 comment:

  1. Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info. Apache Kafka


Search This Blog