- Article History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Email to a Friend
- Printer Friendly Page
- Alert a Moderator
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Alert a Moderator
Airwave - Create multiple users from a CSV file
Airwave - Create multiple users from a CSV file
Introduction : This article provides a script and steps to create multiple users that need to login to Airwave.
This article uses a CSV file to accomplish the task.
Answer :
STEP1:
Create a CSV file with the rows and columns as mentioned in the image below.
The role ID can be determined by navigating to the AMP Setup-->Roles page and clicking on a particular role.
On the role page look into the URL for the role ID.
For example: By clicking on the pencil symbol for admin role I get the following URL information.
https://10.30.156.116/pref_roles?edit=1&id=9
Here the role ID for admin role is 9.
This same ID is to be used in the CSV file.
Copy the CSV file to the /tmp directory.
STEP 2:
Below is a script that needs to copied to /tmp directory using winScp or filezilla.
Script:
#!/bin/bash
while read line
do
password=$(echo $line | cut -d, -f2)
hashpassword=$(echo -n "dgc$password" | md5sum | cut -d ' ' -f1)
newline=$(echo $line | sed -e 's/'$password'/'$hashpassword'/')
/opt/airwave/pgsql/bin/psql -Uairwave airwave -c "insert into users(username,password,role_id,full_name,email,phone,notes,password_format) values ('$(echo $newline | sed -e "s/,/','/g")');"
done
Run the script using following command:
# ./script < <Name of imported csv file>
Note:
This script has been tested on Airwave version 7.7.4
Please consult with Aruba TAC before executing the script.