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” .
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.
Actually, user creation is so simple. What’s more, you can set several attributes in same time.
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.
I have created three brand new group objects.To list the groups which users belong to, groups or lid commands can be performed.
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.
usermod command is run to modify the user object. Let’s change user’s group membership by performing usermod command.
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.
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.