Easy Users Add is an interactive script that simplifies user creation in Linux. Instead of manually using useradd with complex options, this tool provides a guided process.
To install EasyUserAdd, follow these steps:
-
Open your terminal.
-
Run the following command to download the script from GitHub and install it:
curl -sSL https://raw.githubusercontent.com/mahdi-n0rouzi/easy-users-add/main/install.sh | bashsudo chmod +x /usr/local/bin/myuseradd
-
After installation, you can verify that the script is successfully installed by running:
myuseradd
Once installed, you can easily create a new user by running the following command:
========================================
π MyUserAdd - Interactive User Creator
========================================
π€Write the USERNAMEπ
π€ Enter the username: soroush
π Home directory (Default:)
π Home directory (Press Enter for default: /home/soroush):
π₯ Available groups:
sudo IT
WEB ACCOUNTING
DEVELOPER root
π Primary group (Press Enter for default: soroush): IT
β Secondary groups (Use (,) to separate or press Enter to skip): WEB,DEVELOPER,sudo
π₯οΈ Available shells:
/bin/sh /usr/bin/bash /usr/bin/rbash /bin/dash
/bin/bash /bin/rbash /usr/bin/sh /usr/bin/dash
π» Preferred shell (Press Enter for default: /bin/bash):
π¬ Enter a comment for the user (or press Enter to skip): soroush gadget
ποΈ Set password expiry (e.g., 2025-12-31, or press Enter to skip): 2025-06-01
π Creating user with command:
useradd -m -d /home/soroush -s /bin/bash -g IT -G WEB,DEVELOPER,sudo -c "soroush gadget" soroush
π Setting password for soroush...
New password: (write PASSWORD)
Retype new password: (rewrite PASSWORD)
passwd: password updated successfully
β
User soroush created successfully!This command will:
- Create a user named
testuserwith a user ID of1001. - Assign the user to the
usersgroup. - Set a home directory at
/home/testuser. - Use
/bin/bashas the default shell. - Set the comment as
'Test User'.
- β Interactive Setup: The script will prompt you with clear and easy-to-understand questions.
- β Customization: Customize the home directory, primary and secondary groups, user shell, and more.
- β Password Expiry Settings: Optionally, set the password expiry, minimum/maximum days, and warning age.
- β Automatically: sets UID, home directory, and shell
- β Works on Ubuntu, Debian, Arch, Fedora, CentOS
- β Lists available groups for easy selection
- If the user already exists, an error will be displayed, and the script will exit.
- If you forget to run the script with
sudo, the script will remind you to run it as an administrator.
- Home Directory: By default, the home directory is set based on
/etc/default/useraddbut can be customized. - Shell: Default shell is fetched from
/etc/default/useraddor/etc/shells. - Password Expiry: By default, the script will use settings from
/etc/login.defsfor password expiry, minimum and maximum days, and warning age.
- Make sure to have root privileges: The script needs to be executed with
sudofor creating users and modifying system files. - Group and Shell Availability: The script auto-fetches available groups and shells from your system, making the process more efficient and less error-prone.
π More Information
-
πΉ GitHub: Easy Users Add
-
πΉ How to use:
sudo myuseradd
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions, feel free to open an issue on GitHub or contact me at [email protected].