Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk User Creation #3362

Open
matrixbot opened this issue Nov 2, 2024 · 0 comments
Open

Bulk User Creation #3362

matrixbot opened this issue Nov 2, 2024 · 0 comments

Comments

@matrixbot
Copy link
Collaborator

This issue was originally created by @NassemKa at matrix-org/dendrite#3362.

Background information

  • Dendrite version Dendrite 0.13.7+14a6c10
  • Postgres
  • Running in Docker
  • Client used: element web for signing in

Description

  • I have created a script for bulk user creation of 500 user the script reads 500 username and password from a csv file and created them using /usr/bin/create-account -config /etc/dendrite/dendrite.yaml -username $username -password
  • The script is as follow:
#!/bin/bash

# Assuming your CSV file has two columns: username,password
# Adjust accordingly if your CSV format is different

CSV_FILE="usernames_passwords.csv"

# Check if CSV file exists
if [ ! -f "$CSV_FILE" ]; then
  echo "CSV file $CSV_FILE not found."
  exit 1
fi

# Loop through each line in the CSV file
while IFS=',' read -r username password; do
  # Print the username and password
  echo "Creating user: $username with password: $password"
  # Execute the create-account command with the username and password
  /usr/bin/create-account -config /etc/dendrite/dendrite.yaml -username "$username" -password "$password"
  # Add a 1-second delay
  sleep 1
done < "$CSV_FILE"
  • Here is a sample of console i get after running the script:
Creating user: user_1001 with password: tsr0E4Mkha
INFO[0000] Created account: user_1001 (AccessToken: hmzXH1DODVbmHfTpqwT3zpg0LfrNRq53VvmX705cCBc)
Creating user: user_1002 with password: oCwwM12fHy
INFO[0000] Created account: user_1002 (AccessToken: xiGSiaOBe_FreHhOgDrRqoCC7HK7z5HAlQUL5uipCqs)
Creating user: user_1003 with password: ooCVDxYw9G
INFO[0000] Created account: user_1003 (AccessToken: qDQMH-lJYqU-KviUkJXh0wGaFrxs6fBWhlBDhQ2Bqu4)
Creating user: user_1004 with password: z8CsklxNte
INFO[0000] Created account: user_1004 (AccessToken: BdkLUF7OQ981GNKXNtzKQ88qiW0SvMlaj-tmGVPIl7A)
Creating user: user_1005 with password: caxpQYNkF9
INFO[0000] Created account: user_1005 (AccessToken: tZSzzX5wp4YX9z355CE2u7fv_8-9wr8b5_iyVP42O98)
  • Those are the users created in this case (frome the csv file):
user_1001 tsr0E4Mkha
user_1002 oCwwM12fHy
user_1003 ooCVDxYw9G
user_1004 z8CsklxNte
user_1005 caxpQYNkF9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant