user
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| user [2025/01/18 07:24] – [How to delete user] 1211112299 | user [2025/01/18 08:46] (current) – 1211112299 | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| **Note: Make sure to [[installation# | **Note: Make sure to [[installation# | ||
| + | ----- | ||
| ===== 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 '' | + | Add user **//aidel//** to '' |
| sudo adduser username sudo | sudo adduser username sudo | ||
| {{: | {{: | ||
| - | 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: | ||
| {{: | {{: | ||
| + | ----- | ||
| ===== 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// | + | 1. Type the following |
| - | - In this case i use **//sudo userdel aidel//** to delete user // | + | sudo userdel |
| - | - Use **//cat / | + | |
| - | - Previously it will display user aidel details now after delete user aidel no longer exist | + | |
| - | + | ||
| - | {{: | + | |
| - | + | ||
| - | {{: | + | |
| - | + | ||
| - | * Delete User and Home Directory | + | |
| - | **-r**: Recursively removes the user’s home directory and mail spool. | + | |
| - | + | ||
| - | + | ||
| - | {{: | + | |
| - | + | ||
| - | * Force Deletion | + | |
| - | **-f**: Forces the removal of the user account, kills processes, and deletes files. | + | |
| - | + | ||
| - | {{: | + | |
| - | + | ||
| - | * Lock User Before Deleting | + | |
| - | Locks the user's account before deletion to ensure no one logs in during the process. | + | |
| - | + | ||
| - | + | ||
| - | **// | + | |
| - | + | ||
| - | | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | ====== 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// | + | |
| - | - Enter new password then you will be ask to retype you new password | + | |
| - | - Password change | + | |
| - | - | + | |
| - | + | ||
| - | {{: | + | |
| - | + | ||
| - | + | ||
| - | * **Manage Password aging and expiration** | + | |
| - | + | ||
| - | The **sudo chage** | + | |
| - | + | ||
| - | | + | |
| - | + | ||
| - | * **sudo chage -l username** | + | |
| - | Display the current password aging information | + | |
| - | + | ||
| - | + | ||
| - | {{: | + | |
| - | + | ||
| - | * **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** | + | |
| - | + | ||
| - | + | ||
| - | {{: | + | |
| - | + | ||
| - | * **sudo chage -W 7 username** | + | |
| - | The user will receive a warning 7 days before the password expires. | + | |
| - | + | ||
| - | {{: | + | |
| + | 2. In this case, we type the following command to delete user // | ||
| + | sudo userdel aidel | ||
| + | 3. Type the following to check again the list of users. | ||
| + | cat /etc/passwd | ||
| + | Notice that the user **// | ||
| + | {{: | ||
| + | {{: | ||
| + | * **Delete User and Home Directory** | ||
| + | Recursively removes the user’s home directory and mail spool. | ||
| + | sudo userdel -r username | ||
| + | {{: | ||
| + | * **Force Deletion** | ||
| + | Forces the removal of the user account, kills processes, and deletes files. | ||
| + | sudo userdel -f username | ||
| + | {{: | ||
| + | * **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 ==== | ||
| + | | ||
| + | ----- | ||
| + | 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
