User Tools

Site Tools


commands

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
commands [2025/01/03 12:02] – created 1211112228commands [2025/01/17 16:54] (current) – 1211112319
Line 1: Line 1:
 +
 ====== How to create and delete users ====== ====== How to create and delete users ======
 +
 + We use **//sudo adduser username//** to create a new user\\
 + Sudo command must be used by sudoer user only.\\
 +
 + If you want to assign the user to a group for example sudo group you can use **//sudo adduser username sudo//**
 +
 +
 +  * How to create a user:
 +
 + 1. Fisrt User: myself
 +
 +  - Ordered List ItemFirst make sure your are using a sudoer group user or root to perform sudo command.
 +  - Then use **//sudo adduser aidel//** 
 +  - Then you will need to insert your password which i insert **//aidel//** as the password
 +  - Then you will have to insert the details of the user such as full name, group and phone number
 +  - system will ask whether the information is correct or not, if yes press y
 +
 +{{:whatsapp_image_2025-01-11_at_23.25.16_49f8450a.jpg?400|}}
 +
 +{{:whatsapp_image_2025-01-11_at_23.27.10_a5e04d49.jpg?400|}}
 +
 +{{:whatsapp_image_2025-01-11_at_23.27.36_932162f4.jpg?400|}}
 +
 +**//EXTRA//**\\
 + Add user //aidel// to sudo group\\
 +  * use **//sudo adduser username sudo//**
 +
 +
 +
 +{{:whatsapp_image_2025-01-12_at_13.28.50_2303cca1.jpg?400|}}
 +
 +
 +
 +2. Second User: John Doe
 +
 +- Ordered List ItemFirst make sure your are using a sudoer group user or root to perform sudo command.
 +  - Then use **//sudo adduser jdoe//** 
 +  - Then you will need to insert your password which i insert **//sysadmin#1//** as the password
 +  - Then you will have to insert the details of the user such as full name, group and phone number
 +  - system will ask whether the information is correct or not, if yes press y
 +
 +{{:whatsapp_image_2025-01-11_at_23.31.33_e41cae74.jpg?400|}}
 +
 +{{:whatsapp_image_2025-01-11_at_23.31.55_6b63b9c6.jpg?400|}}
 +
 +
 +3. Second User: Will Smith
 +
 +- Ordered List ItemFirst make sure your are using a sudoer group user or root to perform sudo command.
 +  - Then use **//sudo adduser wsmith//** 
 +  - Then you will need to insert your password which i insert **//sysadmin#2//** as the password
 +  - Then you will have to insert the details of the user such as full name, group and phone number
 +  - system will ask whether the information is correct or not, if yes press y
 +
 +{{:whatsapp_image_2025-01-11_at_23.35.44_5a16cf90.jpg?400|}}
 +
 +{{:whatsapp_image_2025-01-11_at_23.36.15_47c2b88d.jpg?400|}}
 +
 +
 +4.Check the user
 +
 +  - Use **//cat /etc/passwd//** 
 +  - it will appear the name of the user and the details
 +
 +{{:whatsapp_image_2025-01-11_at_23.37.20_98252dfd.jpg?400|}}
 +
 +
 +
 +
 +
 +
 +  * How to delete user
 +
 +  - Use **//sudo userdel username//** to delete user.
 +  - In this case i use **//sudo userdel aidel//** to delete user //**aidel**//
 +  - Use **//cat /etc/passwd//** to check again the list of user
 +  - Previously it will display user aidel details now after delete user aidel no longer exist
 +
 +{{:whatsapp_image_2025-01-12_at_13.20.40_6f6cec9d.jpg?400|}}
 +
 +{{:whatsapp_image_2025-01-12_at_13.19.59_ab381a49.jpg?400|}}
 +
 +  * Delete User and Home Directory
 +**-r**: Recursively removes the user’s home directory and mail spool.
 + 
 +
 +{{:screenshot_2025-01-12_191951.png?400|}}
 +
 +  *  Force Deletion
 +**-f**: Forces the removal of the user account, kills processes, and deletes files.
 +
 +{{:screenshot_2025-01-12_192405.png?400|}}
 +
 +  * Lock User Before Deleting
 +Locks the user's account before deletion to ensure no one logs in during the process.
 +
 +
 +**//EXTRA//**
 +
 + {{:screenshot_2025-01-12_193134.png?400|}}
 +
 +
 +
 +
 +
 +====== User Management ======
 +
 +User management in Linux is a critical aspect of system administration. It involves creating, modifying, and managing user accounts and groups to ensure proper access control, system security, and resource allocation. Each user is assigned a unique identity, along with permissions and restrictions.
 +
 +  * **Change user password**
 +
 +  - login to any sudoer group user or root
 +  - Use **//sudo passwd username//** to change user password
 +  - Enter new password then you will be ask to retype you new password
 +  - Password change
 +  - 
 +
 +{{:screenshot_2025-01-16_144702.png?400|}}
 +
 +
 +  * **Manage Password aging and expiration**
 +
 +The **sudo chage** command is used in Linux to manage password aging and expiration policies for a user. It allows administrators to define and control how long a user's password remains valid, enforce password expiration, and specify warnings before password expiration.
 +
 +  - //**sudo chage [option] username**//
 +
 +  * **sudo chage -l username**
 +Display the current password aging information
 +
 +
 +{{:screenshot_2025-01-16_162659.png?400|}}
 +
 +  * **sudo chage -E  2025-12-31 username**
 +Set the account expiration date. The account will be disabled after this date.
 +To set account expiration to never use **sudo change -E -1 username**
 +
 +
 +{{:date.png?400|}}
 +
 +  * **sudo chage -W 7 username**
 +The user will receive a warning 7 days before the password expires.
 +
 +{{:date.png?400|}}
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
commands.1735905764.txt.gz · Last modified: 2025/01/03 12:02 by 1211112228

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki