User Tools

Site Tools


user

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
user [2025/01/18 07:24] – [How to delete user] 1211112299user [2025/01/18 08:46] (current) 1211112299
Line 3: Line 3:
  
 **Note: Make sure to [[installation#Enabling root and superuser on Debian|enable root and superusers]] before you proceed to avoid any errors.** **Note: Make sure to [[installation#Enabling root and superuser on Debian|enable root and superusers]] before you proceed to avoid any errors.**
 +-----
 ===== How to create a user ===== ===== How to create a user =====
 This section will show you how to create a user. We will be creating three users: **yourself, John Doe and Will Smith**. This section will show you how to create a user. We will be creating three users: **yourself, John Doe and Will Smith**.
 +-----
  
   * **First User: Yourself**   * **First User: Yourself**
Line 27: Line 28:
 ==== Adding user to sudo group ==== ==== Adding user to sudo group ====
  
-Add user aidel to ''sudo'' group using +Add user **//aidel//** to ''sudo'' group using 
   sudo adduser username sudo   sudo adduser username sudo
  
 {{:whatsapp_image_2025-01-12_at_13.28.50_2303cca1.jpg?nolink&600}} {{:whatsapp_image_2025-01-12_at_13.28.50_2303cca1.jpg?nolink&600}}
  
-You can also [[Sudoers|add sudoers without sudo here]].+**Note: This method may not work in Debian, you can use [[Sudoers|this]] method instead.**
 ----- -----
  
Line 50: Line 51:
  
   * **Third User: Will Smith**   * **Third User: Will Smith**
 +
 1. Type the following command:  1. Type the following command: 
   sudo adduser wsmith   sudo adduser wsmith
Line 71: Line 73:
 {{:whatsapp_image_2025-01-11_at_23.37.20_98252dfd.jpg?nolink&600}} {{:whatsapp_image_2025-01-11_at_23.37.20_98252dfd.jpg?nolink&600}}
  
 +-----
 ===== How to delete user ===== ===== How to delete user =====
 This section will show you how to delete users. This section will show you how to delete users.
 +-----
  
-  - Use **//sudo userdel username//** to delete user. +1Type the following command to delete user. 
-  - In this case i use **//sudo userdel aidel//** to delete user //**aidel**// +  sudo userdel username 
-  - 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|}}+
  
 +2. In this case, we type the following command to delete user //**aidel**//
 +  sudo userdel aidel
  
 +3. Type the following to check again the list of users.
 +  cat /etc/passwd
 +Notice that the user **//aidel//** no longer exists.
  
 +{{:whatsapp_image_2025-01-12_at_13.20.40_6f6cec9d.jpg?nolink&600}}
 +{{:whatsapp_image_2025-01-12_at_13.19.59_ab381a49.jpg?nolink&600}}
  
 +  * **Delete User and Home Directory**
 +Recursively removes the user’s home directory and mail spool.
 +  sudo userdel -r username
  
 +{{:screenshot_2025-01-12_191951.png?nolink&600}}
  
 +  *  **Force Deletion**
 +Forces the removal of the user account, kills processes, and deletes files.
 +  sudo userdel -f username
  
 +{{:screenshot_2025-01-12_192405.png?nolink&600}}
  
 +  * **Lock User Before Deleting**
 +Locks the user's account to ensure no one logs in during the process before deletion.
 +  passwd -l username
  
 +-----
 +==== Flags for userdel command ====
  
 + {{:screenshot_2025-01-12_193134.png?nolink&600|}}
 +-----
 +You have learned how to create and delete users! Click this [[usermanagement|link]] to further know how to manage user accounts.
user.1737185043.txt.gz · Last modified: 2025/01/18 07:24 by 1211112299

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki