IT & IoT Security | Cloud | It's all about the life itself

Nothing in life is as important as you think it is, while you are thinking about it.

Linux – User & Group Basics 2

Hey dear readers,

In this post, I am going to review user object creation, group object creation, group membership change tasks. The distribution I have setup is CentOS7.

Firstly, I will create few user objects. The very basic command to achieve this task is to run “useradd user_logon_name” .

Screen Shot 2016-05-23 at 19.50.37

As you see, the user is created without a password. That’s why, it can not be used to login to the system. To assign a password to the new user , you can run the passwd command as shown below.

Screen Shot 2016-05-23 at 19.52.54

Actually, user creation is so simple. What’s more, you can set several attributes in same time.

Screen Shot 2016-05-23 at 22.12.28

As it is seen above, -c , -m , -p , -s options are used to set various attributes. Although it seems easy and useful, clear text password usage is insecure!

Let’s continue with the group object.

Screen Shot 2016-05-23 at 22.19.20

I have created three brand new group objects.To list the groups which users belong to, groups or lid commands can be performed.

Screen Shot 2016-05-23 at 22.25.00

As you can above, svcuser belongs to five groups while baris belongs to two groups. lid command can also be used to display the users which are member of a certain group!

id command is another useful command to display group list the a particular user belongs to.

Screen Shot 2016-05-23 at 22.28.52

usermod command is run to modify the user object. Let’s change user’s group membership by performing usermod command.

Screen Shot 2016-05-23 at 22.32.03

By running the command shown above, I added maiev.shadowsong user to three new groups. If you want to remove the user from one of groups , just run the command without the group object you want the user remove from.


Screen Shot 2016-05-23 at 22.45.29

Maiev is now not a member of Mygrp3 .

userdel and groupdel commands are used to delete particular objects.

To  make it short, I will give it a break now 🙂

I wish you have a nice day.

Leave comment

Your email address will not be published. Required fields are marked with *.