Custom User Data


When a user logs in, FastX maps the user’s login name to a linux user account and gets data associated with the user. Typically, the default data is sufficient, but there are cases where an admin may want to fine tune the data that the FastX web server sees (for example limiting user’s groups).

An admin can create a custom script to generate the user data needed for FastX to run sessions as a user. The script is set in the FastX environment variable USER_ID_SCRIPT

USER_ID_SCRIPT

Usage

$USER_ID_SCRIPT login

Output

Returns a JSON object on stdout with the following parameters

{
   "name": "linux_login_name",
   "uid": 1001,
   "gid": 1001,
   "home": "/home/linux_login_name",
   "shell": "/bin/bash",
   "groups": ["group1", "group2", "group3"]
}

Customizing Output

The default script (if USER_ID_SCRIPT is not set) is located in /usr/lib/fastx/4/www/server/user/src/services/id/lib/id.sh

Under the hood, the default script runs the following commands and formats the output into a JSON object.


getent passwd username
groups username

Admins wishing to customize the output should

  1. create a custom executable USER_ID_SCRIPT. It can be in any language.
  2. Run the default script to get the basic output
  3. Parse the JSON
  4. Run your custom code to override the parameters you want
  5. Return the new JSON string in stdout