Create & Edit User and Group on CentOS 7 / RHEL 7

Linux User and Group Administration with Details

Linux User Administration

Users
  • In computing, a user is a person who uses a computer or internet service.
  • A user will have a user account that identifies the user by a username.
  • To log on to a system, a user is required to authenticate himself with a password for the purposes of accounting, security, logging, and resource management.
User private group (UPG) Scheme

When a user is crested a group with the same name as the username is also created.

  • This becomes the primary group for that user.
  • A user can have only one primary group.

When a user is created in Linux/ UNIX, the following are also created by default:

  • Home directory /home/[username]
  • Mail account /var/spool/mail/[username] (if mail services are running)
  • Unique user identifier (UID) and group identifier (GID)

Types of User

There are two types of user

  1. Super User
  2. Normal User
Users Database Files

The information regarding the user is stored in the following files:

  • /etc/passwd
  • /etc/shadow
Content of /etc/passwd
  • The information of each user created is stored in a separate line in the file /etc/passwd.
  • Each record has seven fields separated by a.
as given :-
ravi:x:500:500:prog:/home/ravi:/bin/bash
 1 : 2: 3 : 4 : 5 : 6 : 7

1= user name
2= Mask password
3= UID
4= GID
5= Comment
6= Home directory
7=Shell

Content of /etc/shadow
  • This file contain the encrypted user password
  • Password are encrypted using MDS (Message Digest Version 5) Algorithm
Creating user
Adding a user
[[email protected]~]# useradd <username>
[[email protected]~]# useradd<option> <arguments><username>
Options

-u UID
-g primary grpname/GID
-o Override
-G Secondary group
-c Comment
-d Home directory
-s Shell

User Password
Creating or changing a user password
[[email protected]~]# passwd <username>

Linux Group Administration

Group

Group is a collection of user to whom the sane permissions are to be applied.

There are two types of groups

  • Primary
  • Secondary
Group Database Files

The information regarding the groups are stored in the following files:

  • /etc/group
  • /etc/gshadow
Content of /etc/group
  • The information of each group created is stored in a separate line in the file/etc/group
  • Each record has four fields separated by.
as given:-
ravi:x:500:sachin,kumar
1 :2: 3 : 4

1 = Group name
2 = Encrypted password
3 = List of administrative members
4 = list of members

Content of etc/gshadow
  • This file contains the encrypted group password
  • Passwords are encrypted using MDS (Message Digest Version 5) Algorithm
ravi:hjkadfyhs8:admin:sachin,kumar

1 : 2 : 3 : 4
1 = Group name
2 = Encrypted Password
3 = List of administrative members
4 = List of members

Creating a Group

Creating a group
[[email protected]~]# groupadd <group name>
[[email protected]~]# groupadd <option> <arguments> <grpname>

Options

-g GID
-o Override

Modifying a Group

Modifying a group
[[email protected]~]# groupmod <option> <arguments> <grpname>

Options

-g GID
-o Override
-n Group name

Deleting a Group

Deleting a group
[[email protected]~]# groupdel <group name>

Note : A group cannot be deleted if it has primary members.

Group Membership

Group membership
[[email protected]~]# gpasswd <option> <arguments> <grpname>

Options

-M Add multiple users to the group
-A Adds a group administrator
-a Add a user to the group
-d Delete a user from the group

Managing User and Groups Using (GUI)

Managing users and group using (GUI)
[[email protected]~]# System-config-users &

Congratulations now, you have learned Linux User and Group Administration with Details.You’re now ready to use the Linux User and Group Administration on your Linux systems.

Hot Right Now

Related Post

COMMENTS