Creating a User with an Expiry Date on Linux
In Linux-based systems, you can create a user with an account expiration date using the useradd
command. This is useful for temporary accounts, such as for contractors or trainees.
Example: Create a User Named wycliffe with an Expiry Date
To create a user named wycliffe
that expires on December 7, 2025, use the following command:
sudo useradd -e 2025-12-07 wycliffe
`
Command Breakdown
Component | Description |
---|---|
sudo |
Runs the command with administrative (superuser) privileges. |
useradd |
The command used to create a new user account. |
-e 2025-12-07 |
Sets the account expiration date to December 7, 2025. |
wycliffe |
The username of the account being created. |
Top comments (0)