Skip to content

phenix admin

Every command on this page also accepts the global flags.

phenix admin

Administration of users, roles and API tokens

Synopsis

Administration of users, roles and API tokens

  The list and get commands read the store. The commands that change users,
  roles or tokens call the running phenix server over its unix socket
  (--unix-socket), as the user global-admin. The server then closes the
  websockets of a user whose role changes, revokes the capture grants of a
  deleted user, and signs tokens with its JWT signing key.
phenix admin [flags]

Options

  -h, --help   help for admin

SEE ALSO

phenix admin role

List, get, create, update, or delete roles

Synopsis

List, get, create, update, or delete roles

  A role is a list of policies. A policy gives verbs on resources, and
  optionally only on some resource names. Give a policy as
  resources=<list>;verbs=<list>[;names=<list>], each list separated by
  commas. Only custom roles change: a built-in role cannot. A role cannot
  give more than the user global-admin of the unix socket holds, and no
  custom role may give roles create, patch or delete.
phenix admin role [flags]

Options

  -h, --help   help for role

SEE ALSO

phenix admin role create

Create a custom role

Synopsis

Create a custom role

  Creates a role with the policies that --policy gives. The config name is
  --config-name, or else the role name in lower case with a "-" for each run
  of other characters. Give the role to a user with phenix admin user
  update <username> --role <role name>.
phenix admin role create <role name> [flags]

Examples

phenix admin role create "Lab Viewer" --policy 'resources=experiments,vms;verbs=list,get;names=lab-*'

Options

      --config-name string   Config name of the role (default from the role name)
  -h, --help                 help for create
      --policy stringArray   Policy of the role, as resources=<list>;verbs=<list>[;names=<list>] (repeatable)

SEE ALSO

phenix admin role delete

Delete a custom role that no user has

Synopsis

Delete a custom role that no user has

  --dry-run reads the store: it checks that the role exists, is not built
  in, and that no user has it, and does not call the server. The server
  also refuses a role that its settings name, such as in ui.users.
phenix admin role delete <role name> [flags]

Options

      --dry-run   Show what the command would change, and change nothing
  -h, --help      help for delete

SEE ALSO

phenix admin role get

Show the policies of a role

Synopsis

Show the policies of a role

  The role name is its name or its config name. -o json and -o yaml print
  the role with the fields of GET /roles/{name} and its config name
  (configName).
phenix admin role get <role name> [flags]

Options

  -h, --help            help for get
  -o, --output string   Output format (table, json, yaml) (default "table")

SEE ALSO

phenix admin role list

List the roles

Synopsis

List the roles

  -o json and -o yaml print each role with the fields of GET /roles and its
  config name (configName), sorted by config name.
phenix admin role list [flags]

Options

  -h, --help            help for list
  -o, --output string   Output format (table, json, yaml) (default "table")

SEE ALSO

phenix admin role update

Replace the policies of a custom role

Synopsis

Replace the policies of a custom role

  Replaces all policies of the role with those that --policy gives. Each
  user with the role gets the new policies, with the resource names that
  the user had, and the websockets of those users close.
phenix admin role update <role name> [flags]

Examples

phenix admin role update lab-viewer --policy 'resources=experiments;verbs=list,get'

Options

  -h, --help                 help for update
      --policy stringArray   Policy of the role, as resources=<list>;verbs=<list>[;names=<list>] (repeatable)

SEE ALSO

phenix admin token

Create API tokens

phenix admin token [flags]

Options

  -h, --help   help for token

SEE ALSO

phenix admin token create

Create an API token for a user

Synopsis

Create an API token for a user

  The running phenix server signs the token with its JWT signing key
  (ui.jwt-signing-key) and adds it to the tokens of the user. The command
  writes the token to stdout and its expiry to stderr. Send the token in the
  X-Phenix-Auth-Token header. The token is valid until it expires or the
  user signs out with it. --lifetime is a duration, such as 12h, or a whole
  number of days.
phenix admin token create <username> [flags]

Examples

phenix admin token create alice
TOKEN=$(phenix admin token create ci-bot --lifetime 30 --description "CI runner")

Options

      --description string   Description of the token (default "manually generated" and the time)
  -h, --help                 help for create
      --lifetime string      How long the token is valid: a duration or a whole number of days (default "24h")

SEE ALSO

phenix admin user

List, get, create, update, or delete users

phenix admin user [flags]

Options

  -h, --help   help for user

SEE ALSO

phenix admin user create

Create a user

Synopsis

Create a user

  Creates a user with the role --role. --resource-names limits the role to
  those resource names, such as my-exp/*. The command asks for the password
  twice on the terminal, or reads it from the first line of stdin with
  --password-stdin. The password must meet the password settings. The user
  may get and update their own user.
phenix admin user create <username> [flags]

Examples

phenix admin user create alice --role experiment-user --resource-names 'lab-*'
printf '%s\n' "$PASSWORD" | phenix admin user create bob --role global-viewer --password-stdin

Options

      --first-name string        First name of the user
  -h, --help                     help for create
      --last-name string         Last name of the user
      --password-stdin           Read the password from the first line of stdin
      --resource-names strings   Resource names that the role applies to (comma list)
      --role string              Role of the user, by its name or its config name

SEE ALSO

phenix admin user delete

Delete a user

Synopsis

Delete a user

  Deletes the user, closes the websockets of the user, and revokes the
  capture grants given to the user. --dry-run reads the store: it checks
  that the user exists and is not global-admin, and does not call the
  server.
phenix admin user delete <username> [flags]

Options

      --dry-run   Show what the command would change, and change nothing
  -h, --help      help for delete

SEE ALSO

phenix admin user get

Show a user and the policies of its role

Synopsis

Show a user and the policies of its role

  -o json and -o yaml print the user with the fields of GET /users/{username}.
phenix admin user get <username> [flags]

Options

  -h, --help            help for get
  -o, --output string   Output format (table, json, yaml) (default "table")

SEE ALSO

phenix admin user list

List the users

Synopsis

List the users

  -o json and -o yaml print each user with the fields of GET /users, sorted
  by username.
phenix admin user list [flags]

Options

  -h, --help            help for list
  -o, --output string   Output format (table, json, yaml) (default "table")

SEE ALSO

phenix admin user update

Change the names, role, resource names, or password of a user

Synopsis

Change the names, role, resource names, or password of a user

  Changes only what the flags give. --resource-names without --role keeps
  the role of the user. --password changes the password: the command asks
  for the current password and the new password on the terminal, or reads
  them from the first two lines of stdin with --password-stdin. The API
  changes a password only with the current password.
phenix admin user update <username> [flags]

Examples

phenix admin user update alice --role experiment-admin
phenix admin user update alice --first-name Alice --last-name Smith
phenix admin user update alice --password

Options

      --first-name string        New first name of the user
  -h, --help                     help for update
      --last-name string         New last name of the user
      --password                 Change the password
      --password-stdin           Change the password, and read the current and the new password from stdin
      --resource-names strings   Resource names that the role applies to (comma list)
      --role string              New role of the user, by its name or its config name

SEE ALSO