User management includes everything from creating a user to deleting a user on your system. User management can be done in three ways on a Linux system.
Understand the /etc/passwd file
User account information is stored in the /etc/passwd
file. This information includes the account name, home directory location, and default shell, among other values. Linux sysadmins should be able to recognize these fields.
Each field is separated by a :
character, and not all fields must be populated, but you must delineate them.
Here's an example of the /etc/passwd
fields:
username:password:UID:GID:comment:home:shell
example:
dgarn:x:1001:1001::/home/dgarn:/bin/bash
Understand the /etc/shadow file
Administrators should recognize each field in /etc/shadow
. Several of the fields pertain to password requirements.
Here's an example of /etc/shadow
fields:
username:password:last password change:min:max:warning:inactive:expired
Create, modify, and delete user accounts
The process for managing user accounts is very straightforward. Sysadmins either add, modify, or delete users, and the related commands
useradd
usermod
userdel
Task : Create 2 users and just display their Usernames.
use cat /etc/passwd
to display their usernames.
Happy Learning !!