Using CLI

Learn how to create a user in Ranger using CLI.

Ensure that you have the Administrator user name and password for Ranger.
  1. Open a terminal on your device.
  2. Run the following curl command to create a user in Ranger:
    curl -u [***RANGER_ADMIN_USERNAME***]:[***RANGER_ADMIN_PASSWORD***] \
     --include --location \
     --request POST \
      --header "Content-Type: application/json" \
      --header "accept: application/json" \
      --data '{
        "loginId": "[***UNIQUE_USERNAME_FOR_THE_NEW_USER***]",
        "name": "[***NAME_OF_THE_USER***]",
        "password": "[***PASSWORD_FOR_THE_USER***]",
        "firstName": "[***FIRST_NAME_OF_THE_USER***]",
        "lastName": "[***LAST_NAME_OF_THE_USER***]",
        "emailAddress": "[***UNIQUE_USERNAME_FOR_THE_NEW_USER***]@[***DOMAIN_NAME***].com",
        "userRoleList": ["ROLE_USER"],
        "userPermList": [
          { "moduleId": 1, "isAllowed": 1 },
          { "moduleId": 3, "isAllowed": 1 },
          { "moduleId": 7, "isAllowed": 1 }
        ]
      }' \
      "[***RANGER_URL***]/service/xusers/secure/users"

    Example,

    curl -u admin:Admin123 \
     --include --location \
     --request POST \
      --header "Content-Type: application/json" \
      --header "accept: application/json" \
      --data '{
        "loginId": "svc-iceberg-rest-catalog",
        "name": "svc-iceberg-rest-catalog",
        "password": "Password123!",
        "firstName": "Iceberg REST",
        "lastName": "Catalog",
        "emailAddress": "svc-iceberg-rest-catalog@example.com",
        "userRoleList": ["ROLE_USER"],
        "userPermList": [
          { "moduleId": 1, "isAllowed": 1 },
          { "moduleId": 3, "isAllowed": 1 },
          { "moduleId": 7, "isAllowed": 1 }
        ]
      }' \
      "https://ranger-host.example.com:6182/service/xusers/secure/users"