Thanks to visit codestin.com
Credit goes to github.com

Skip to content

πŸ“Easy Users Add is a Linux automation tool that simplifies user creation via an interactive Bash script, eliminating complex useradd commands.

License

Notifications You must be signed in to change notification settings

mahdi-n0rouzi/easy-users-add

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Easy Users Add - Simplify User Creation in Linux

πŸ” What is Easy Users Add?

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.

πŸ“₯ Installation

To install EasyUserAdd, follow these steps:

  1. Open your terminal.

  2. 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 | bash
    sudo chmod +x /usr/local/bin/myuseradd
  3. After installation, you can verify that the script is successfully installed by running:

    myuseradd

πŸš€ How to Use

Once installed, you can easily create a new user by running the following command:

Example:

========================================
πŸš€ 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 testuser with a user ID of 1001.
  • Assign the user to the users group.
  • Set a home directory at /home/testuser.
  • Use /bin/bash as the default shell.
  • Set the comment as 'Test User'.

πŸ› οΈ Features

  • βœ… 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

🚨 Error Handling

  • 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.

βš™οΈ Default Settings

  • Home Directory: By default, the home directory is set based on /etc/default/useradd but can be customized.
  • Shell: Default shell is fetched from /etc/default/useradd or /etc/shells.
  • Password Expiry: By default, the script will use settings from /etc/login.defs for password expiry, minimum and maximum days, and warning age.

Installation Notes:

  1. Make sure to have root privileges: The script needs to be executed with sudo for creating users and modifying system files.
  2. Group and Shell Availability: The script auto-fetches available groups and shells from your system, making the process more efficient and less error-prone.

🌟 Enjoy using EasyUserAdd for a smooth user creation process!

πŸ”— More Information

  • πŸ”Ή GitHub: Easy Users Add

  • πŸ”Ή How to use: sudo myuseradd


    🏷️ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“£ Support

If you encounter any issues or have questions, feel free to open an issue on GitHub or contact me at [email protected].

About

πŸ“Easy Users Add is a Linux automation tool that simplifies user creation via an interactive Bash script, eliminating complex useradd commands.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published