User Administration

The Complete Guide to “useradd” Command in Linux.

A system administrator, or sysadmin, is a person who is responsible for the upkeep, configuration, and reliable operations of computer systems; especially multi-user computers, such as servers. The system administrator seeks to ensure that uptime, performance, resources, and security of the computers that manage meet the needs of the users, without exceeding a set budget when doing so. The meet these needs, a system administrator may acquire, install, or upgrade computer components and software, provide routine automation, maintain security policies, troubleshoot, train, supervise staff or offer technical support for projects.
User Administration

There are three types of accounts on a Linux system

  1. Root account : In computing, the superuser is a special user account used for system administration. Depending on the operating system, the actual name of the account might be root, administrator, admin, or supervisor. In some cases, the actual name of the account is not the determining factor on a Unix-like system, for example, the user with a user identifier of zero is the superuser, regardless of the name of that account and in the system which implements a role-based security model, any user with the role of superuser can carry out all actions of the superuser account.
  2. System accounts : System accounts are those needed for the operation of system-specific components. Like sshd.
  3. User accounts : A user is a person who utilizes a computer or network service. Users of computer systems and software products generally lack the technical expertise required to fully understand how they work. General users are typically assigned to these accounts and usually have limited access to critical system files and directories.

Users and Groups administration files

  • /etc/passwd : 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/gshadow: This file contains secure group account information.

Command & Description

  • Useradd: Creates user or system accounts.
  • Usermod: Modifies user accounts

  • Userdel: Remove a user or system account

  • Groupadd: Adds groups to the system

  • Groupmod: Modifies group attributes

  • Groupdel: Removes groups from the system

Useradd [options]

  • [-c]  comment.

  • [-e ] expire date.

  • [-m ] create a home directory for user.

  • [-r ] create a system account.

  • [-s]  Defines what shell to use.

  • [-u] user ID

Syntax: 

“useradd <-u uid> <-g gid> <-c comment> <-m user home directory>  <-s user  shell> <user name>” 

Example: 

useradd  -u 501 -g 1001-c “Test Account” -m /home/test  -s /bin/bash test01

Also Watch this “user add in Linux Explained with Examples” Tutorial video.

Usermod [options]

  • [-g] new primary group

  • [-G]  new supplementary group

  • [-l]  new value login name

  • [-L]  locks the user account

  • [-u] new user id for the user

  • [-U] unlocks the user

 Userdel [options]

  • [-f] forces deletion

  • [-r] removes the user’s home directory 

 Passwords

If we are creating user and not assigned password. Done anyone can login (No). By default an account is locked,

Leave your message if anything missed and we appreciate your comments.

 

mukesh.thakur87: