UNIX / Linux User Administration - Unix/Linux

What are UNIX / Linux User Administration?

In this chapter, we will converse in feature about user administration in UNIX.

There are three types of accounts on a UNIX system −

Root account

This is also called super user and would have entire and logical control of the system. A super user can run any commands without any constraint. This user should be supposed as a system administrator.

System accounts

System accounts are those required for the operation of system-specific mechanism for instance mail accounts and the sash accounts. These accounts are usually necessary for some specific function on your system, and any modification to them could negatively change the system.

User accounts

User accounts offer interactive admission to the system for users and groups of users. Specific users are normally assigned to these accounts and usually have incomplete access to critical system files and directories.

UNIX supports a conception of Group Account which sensibly groups a number of accounts. Every account would be a part of another group account. A UNIX group plays essential role in handling file permissions and development administration.

Managing Users and Groups

There are four most important user management files −

  • /etc/passed − Keeps the user account and password information. This file holds the majority of information about accounts on the UNIX system.
  • /etc/shadow − Holds the encrypted password of the corresponding account. Not all the systems support this file.
  • /etc/group − this file contains the group information for each account.
  • /etc/shadow − this file contains secure group account information.

Check all the above files using the cat command.

The following table lists out commands that are accessible on common of UNIX systems to make and manage accounts and groups −

S.No. Command & Description
1
useradd
Adds accounts to the system
2
usermod
Modifies account attributes
3
userdel
Deletes accounts from the system
4
groupadd
Adds groups to the system
5
groupmod
Modifies group attributes
6
groupdel
Removes groups from the system

You can apply Manage Help to check total syntax for each command mentioned here.

Create a Group

We will now recognize how to create a group. For this, we should to create groups before creating any account otherwise; we can create use of the existing groups in our system. We have all the groups scheduled in /etc/groups file.

All the avoidance groups are system account exact groups and it is not optional to use them for ordinary accounts. So, following is the syntax to generate a recent group account –

The following table lists out the parameters −

S.No. Option & Description
1
-g GID
The numerical value of the group's ID
2
-o
This option permits to add group with non-unique GID
3
-r
This flag instructsgroupaddto add a system account
4
-f
This option causes to just exit with success status, if the specified group already exists. With -g, if the specified GID already exists, other (unique) GID is chosen
5
groupname
Actual group name to be created

If you do not denote any parameter, then the system make use of the default values.

Following instance create a developers group with defaulting values, which is very much suitable for most of the administrator.

Modify a Group

To modify a group, use the grumped syntax –

To transform the developers_2 group name to developer, type –

Here is how you will alteration the financial GID to 545 –

Delete a Group

We will now realize how to delete a group. To delete an active group, all you want is the grouped command and the group name. To delete the monetary group, the command is –

This removes only the group, not the files related with that group. The files are still available by their owners.

Create an Account

Let us observe how to make a new account on your UNIX system. Following is the syntax to form a user's account –

The following table lists out the parameter −

S.No. Option & Description
1
-d homedir
Specifies home directory for the account
2
-g groupname
Specifies a group account for this account
3
-m
Creates the home directory if it doesn't exist
4
-s shell
Specifies the default shell for this account
5
-u userid
You can specify a user id for this account
6
accountname
Actual account name to be created

If you do not identify any limit, then the system make use of the default values. The user adds commands modifies the /etc/passed, /etc/shadow, and /etc/group files and create a home directory.

Following is the instance that creates an account mcmohd, setting its home directory to /home/mcmohd and the collection as developers. This user would have Koran Shell assign to it.

Before issuing the above command, make sure you already have the developers group created using the grouped command.

Once an account is formed you can position its password using the passwdcommand as follows –

When you kind passed account name, it give you and selection to alter the password, provided you are a super user. Otherwise, you can change just your password using the same command but without specify your account name.

Modify an Account

The sermon command enables you to make changes to an existing account from the command line. It uses the same influence as the useraddcommand, plus the -l argument, which allow you to modify the account name.

For instance, to modify the account name mcmohd to mcmohd20 and to alter home directory consequently, you will require issuing the following command –

Delete an Account

The ushered command can be used to delete an existing user. This is a very unsafe command if not used with concern.

There is only one dispute or option available for the command .r, for remove the account's home directory and mail file.

For instance, to eliminate account mcmohd20, issue the following command –

If you desire to keep the home directory for backup purpose, exclude the -option. You can eliminate the home directory as required at a later time.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Unix/Linux Topics