User Management in Linux

There are 2 type of users in Linux 

1. Privileged users - by default a root users

2. Unprivileged users - normal or system users


Normal user or system user no big difference : normal user is a regular user account & system user is also a regular account but used for specific purpose i.e daemons, running a application

Root user is also referred as superuser, this account has all privileges in system, so need to be cautious when using this account as we can cause damage to the system

What all we can do with root ?

1. installing software

2. managing users

3. partition creations (Note: with Normal user you can manage removable drives)

NOTE: It is recommended that we login to the system with normal user account and switch to superuser account when needed


Some useful commands:

id <useraccount> - Eg: id user01

useradd -m <username> - creating a user (-m option creates the home directory for the user)

passwd <username> - setting password for the username

usermod -aG wheel <username> -  adding usernmae to wheel account

userdel -r <username>


Some important files:

/etc/passwd - this file contains the user details & password of the accounts (in older days)

/etc/shadow - this file contains password of the user accounts in /etc/passwd in encrypted format

/etc/group -  this file we can see the users belonging group

Easy way to create a user is adding an entry in these files, as it poses security risks its now handled via commands


Switch User

This is used to switch user (su) , when needed to switch between the useraccounts we can use this


su <useraccount>


password will be prompted and on successful authentication , will se a successful login



Comments

Popular posts from this blog

How to setup SSH Key-Based Authentication (Private & Public keys)

How services works in Linux

Permissions in Linux