Admin API - User
Create User (shell)
Instructions
- SSH into your Config / Installer node (Node 1) as training if you have not already
- Create the JSON payload
echo '{ "active": "true", "address1": "", "address2": "", "city": "", "country": "", "emailAddr": "", "fullName": "Engineering Student", "groupId": "Engineering", "ldapEnabled": false, "phone": "", "state": "", "userId": "engineer1", "userType": "User", "website": "", "zip": "" }' > ~/admin_api/create_user.txt
Instructions
- Create the new user from the payload using the Admin API.
curl -X PUT -H "Content-Type: application/json" -k -u sysadmin:$auth_pass -d @/home/training/admin_api/create_user.txt https://$admin_endpoint:19443/user
Info
This creates a user who is a member of the Engineering Group, however this user cannot log into the CMC yet because the User password has not been set. This maybe a good thing in your environment where there is no requirement for the user account to access cmc.
Instructions
- Lets get the S3 credentials for the newly created user.
curl -s -X GET -k -u sysadmin:$auth_pass "https://$admin_endpoint:19443/user/credentials/list/active?userId=engineer1&groupId=Engineering" | python -mjson.tool
Important
You can see the S3 access key and secret key for this new user (take a copy of these for later)
Info
If you want this new user to have access to the CMC you will need to create a password for the user.
Passwords must meet the following conditions by default:
- Minimum of nine characters, maximum of 64 charactes
Must contain:
- At least one lower case letter
- At least one upper case letter
- At least one number
- At least one special character such as !, @, #, $, %, ^, etc.
Instructions
- Set a CMC password for the engineer1 user as @Engineer1
curl -X POST -k -u sysadmin:$auth_pass "https://$admin_endpoint:19443/user/password?userId=engineer1&groupId=Engineering&password=@Engineer1"
Note
This command is also useful if you forget the admin password for the CMC as you can change the admin password using the same method where userId=admin&groupId=0
We can now login to the CMC using the new CMC credentials.
Info
- Ensure Group Name is set to Engineering
- Ensure User ID: is engineer1
- Ensure Password: is @Engineer1