Update a permission target with jf rt permission-target-update

Replace an existing Artifactory permission target from a template with jf rt permission-target-update.

Update a permission target in the JFrog Platform from a template file.

🚧

Warning

This command replaces the entire permission target definition with the contents of the template file. It is not a partial patch. Ensure your template includes all fields you want to retain — any field omitted from the template will be removed from the permission target.

Synopsis

jf rt permission-target-update <template-path> [options]

Aliases: rt ptu

Arguments

ArgumentRequiredDescription
<template-path>YesLocal file system path to the template file. Create it with jf rt ptt

Options

FlagDefaultDescription
--access-tokenJFrog access token
--client-cert-key-pathPrivate key file for the client certificate in PEM format
--client-cert-pathClient certificate file in PEM format
--passwordJFrog password
--server-idServer ID configured using the jf config command
--ssh-key-pathSSH key file path
--ssh-passphraseSSH key passphrase
--urlJFrog Artifactory URL (example: https://acme.jfrog.io/artifactory)
--userJFrog username
--varsSemicolon-separated variables in the form "key1=value1;key2=value2". In the template, use ${key1} placeholder syntax. Variable substitution is single-value only. To include multiple repositories or groups, list them directly in the template instead of passing them through --vars.
--formatOutput format: json only. When omitted, produces no output (backward-compatible). See jf rt output format.

Template Format

The template is a JSON file that describes the full permission target definition. Generate one interactively with jf rt ptt, or write one manually using the format below.

📘

Note

jf rt ptt is an interactive command that requires a TTY. It cannot be run in CI/CD pipelines or non-interactive shells. In those environments, create the template JSON file manually.

{
  "name": "my-permission-target",
  "repo": {
    "repositories": "libs-release",
    "actions": {
      "users": {
        "alice": ["read", "write"]
      },
      "groups": {
        "developers": ["read", "write", "annotate", "delete", "manage"]
      }
    }
  },
  "build": {
    "repositories": "artifactory-build-info",
    "actions": {
      "groups": {
        "developers": ["read", "manage"]
      }
    }
  }
}

Key schema notes:

  • repositories and the build section's fixed value: see Permission Target Template for the full schema rules.
  • Supported permission values: read, write, annotate, delete, manage, managedXrayMeta, distribute.
  • To use variable substitution, replace any value with ${variableName} and pass the variable via --vars.

Examples

Update a permission target from a template file

To update a permission target from a template file:

  • Run:
jf rt permission-target-update <template-path>

Where:

  • <template-path>: Path to the JSON template (see Arguments).

Full example:

jf rt permission-target-update ./template.json

Expected output:

[Info] Updating permission target...

A clean exit with this message confirms the permission target was updated successfully.

Update with variable substitution

Use --vars to inject values into ${placeholder} fields in your template at runtime. This is useful for reusing a single template across multiple environments or permission targets.

To update a permission target with variable substitution:

  • Run:
jf rt permission-target-update <template-path> --vars "<key1>=<value1>;<key2>=<value2>"

Full example:

jf rt permission-target-update ./template.json --vars "groupName=developers;repoName=libs-release"

Given a template containing "repositories": "${repoName}" and "${groupName}": [...], this command substitutes the values before submitting. Expected output:

[Info] Updating permission target...

View command usage

To view command usage:

  • Run:
jf rt permission-target-update --help

Important Notes

  • Requires admin privileges on the Artifactory instance.
  • The template format used by jf rt permission-target-update is the same as the one created by jf rt ptt (permission-target-template). Always use jf rt ptt to generate your initial template to ensure the correct schema.
  • The permission target identified by the name field in the template must already exist. This command updates an existing target. It does not create one. To create a new permission target, use jf rt permission-target-create.

Troubleshooting

ErrorCauseFix
open <path>: no such file or directoryThe template file path is wrong or the file does not existVerify the path and confirm the file exists
json: cannot unmarshal array into Go struct field PermissionSectionAnswer.repositories of type stringThe repositories field in the template is a JSON array instead of a stringChange ["repo-name"] to "repo-name" in the template
server response: 401Authentication failedRe-run jf config add to refresh credentials, or check that your access token has not expired
Wrong number of arguments (0)The required <template-path> argument was not providedProvide the path to your template file as the first argument

Frequently Asked Questions

This section provides answers to frequently asked questions.

plusFAQs
Q: How do I update an existing permission target?

A: Run jf rt permission-target-update <template-path> with a template whose name field matches an existing permission target. See Examples for the full command.

Q: What happens if I omit a field from the template when updating?

A: The update replaces the entire permission target definition. Any field omitted from the template is removed from the permission target, since this is not a partial patch.

Q: What is the difference between jf rt permission-target-update and jf rt permission-target-create?

A: permission-target-update requires the named target to already exist and replaces its full definition, while permission-target-create fails if a target with that name already exists.

Q: What permissions do I need to update a permission target?

A: You need admin privileges on the Artifactory instance. See Important Notes.

Q: Can I use variables when updating a permission target?

A: Yes. Add ${variableName} placeholders to the template and pass real values at runtime with --vars. See Update with variable substitution.

Related Topics



What’s Next

To remove a permission target, see jf rt permission-target-delete.

Did this page help you?