Bulk Linux Users Creation

Bulk User Creator (Linux)

Description

This script automates the bulk creation of user accounts on a Linux system. It prompts for the username and the number of users to create. Usernames are generated based on the input and stored…


This content originally appeared on DEV Community and was authored by Anass Assim

Bulk User Creator (Linux)

Description

This script automates the bulk creation of user accounts on a Linux system. It prompts for the username and the number of users to create. Usernames are generated based on the input and stored in a CSV file. Each user is created with a default password that matches their username.

Requirements

  • Linux environment
  • useradd command available
  • To encrypt the password of the users using mkpasswd , is it necesarry to install whois Packet.
   sudo apt install whois

Installation

  1. Clone the repository:
   git clone https://github.com/ciscoAnass/Bulk-Linux-User.git
   cd Bulk-Linux-User
  1. Make the script executable:
   chmod +x BulkUsers.sh

Creating a Command Alias (Optional but recommended)

  • Add the following line to your shell configuration file (e.g., ~/.bashrc for bash):
echo "alias bulkuser='sudo ~/Bulk-Linux-User/BulkUsers.sh'" >> ~/.bashrc

Then, apply the changes:

source ~/.bashrc

Usage

Now you can use the bulkuser alias in your terminal to run the script with parameters. Here's how:

  • To create 7 users with the username "poppy" (You can choose whatever Username you want to create , also numbers):
bulkuser poppy 7
  • This will generate output similar to:
User : poppy1 , Password : poppy1
User : poppy2 , Password : poppy2
User : poppy3 , Password : poppy3
User : poppy4 , Password : poppy4
User : poppy5 , Password : poppy5
User : poppy6 , Password : poppy6
User : poppy7 , Password : poppy7
  • Additionally, it will create a UsrAccess-poppy.csv file containing the usernames and passwords.

Verification

To verify that the users have been created correctly, follow these steps:

  1. Check User Accounts: List the last 7 users created on the system to ensure they have been created:
   getent passwd | tail -7 | cut -d: -f1

Notes

  • Ensure you have the necessary permissions to execute user creation commands (useradd).
  • Consider security implications when using default passwords.


This content originally appeared on DEV Community and was authored by Anass Assim


Print Share Comment Cite Upload Translate Updates
APA

Anass Assim | Sciencx (2024-10-18T23:23:20+00:00) Bulk Linux Users Creation. Retrieved from https://www.scien.cx/2024/10/18/bulk-linux-users-creation/

MLA
" » Bulk Linux Users Creation." Anass Assim | Sciencx - Friday October 18, 2024, https://www.scien.cx/2024/10/18/bulk-linux-users-creation/
HARVARD
Anass Assim | Sciencx Friday October 18, 2024 » Bulk Linux Users Creation., viewed ,<https://www.scien.cx/2024/10/18/bulk-linux-users-creation/>
VANCOUVER
Anass Assim | Sciencx - » Bulk Linux Users Creation. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/10/18/bulk-linux-users-creation/
CHICAGO
" » Bulk Linux Users Creation." Anass Assim | Sciencx - Accessed . https://www.scien.cx/2024/10/18/bulk-linux-users-creation/
IEEE
" » Bulk Linux Users Creation." Anass Assim | Sciencx [Online]. Available: https://www.scien.cx/2024/10/18/bulk-linux-users-creation/. [Accessed: ]
rf:citation
» Bulk Linux Users Creation | Anass Assim | Sciencx | https://www.scien.cx/2024/10/18/bulk-linux-users-creation/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.