Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 3. Introduction to the IdM command-line utilities
You can use the CLI to automate administrative tasks, such as creating users and managing certificates. Learn more about the basics of using the Identity Management (IdM) command-line utilities.
3.1. Prerequisites Copier lienLien copié sur presse-papiers!
- An installed and accessible Identity Management (IdM) server. For more information, see Installing Identity Management.
- To use the IPA command-line interface, authenticate to IdM with a valid Kerberos ticket.
3.2. What is the IPA command-line interface Copier lienLien copié sur presse-papiers!
Manage your Identity Management (IdM) environment by using the IPA command-line interface (CLI). The CLI provides a comprehensive set of subcommands to automate the management of users and hosts, security policies, and certificates.
You can use the IPA CLI to perform the following actions:
- Add, manage, or remove users, groups, hosts and other objects in the network.
- Manage certificates.
- Search the directory to find specific entries and view their details.
- Display and list objects.
- Set access rights.
- Access help to find the correct command syntax and options.
3.3. What is the IPA help Copier lienLien copié sur presse-papiers!
Access the built-in Identity Management (IdM) documentation for command syntax, usage examples, and available subcommands. The IPA command-line interface (CLI) generates available help topics from loaded IdM plugin modules.
The ipa help utility follows a specific structure for queries:
ipa help [TOPIC | COMMAND | topics | commands]
$ ipa help [TOPIC | COMMAND | topics | commands]
-
[]— Brackets mean that all parameters are optional and you can write justipa helpand the command will be executed. |— The pipe character means or. Therefore, you can specify aTOPIC, aCOMMAND, ortopics, orcommands, with the basicipa helpcommand:-
topics— You can run the commandipa help topicsto display a list of topics that are covered by the IPA help, such asuser,cert,serverand many others. -
TOPIC— The TOPIC with capital letters is a variable. Therefore, you can specify a particular topic, for example,ipa help user. -
commands— You can enter the commandipa help commandsto display a list of commands which are covered by the IPA help, for example,user-add,ca-enable,server-showand many others. -
COMMAND— The COMMAND with capital letters is a variable. Therefore, you can specify a particular command, for example,ipa help user-add.
-
When you enter the ipa help command without options, the system displays information about basic help usage and the most common command examples.
3.4. Using IPA help topics Copier lienLien copié sur presse-papiers!
You can use the ipa help topics to discover available plugins and to view specific command examples for objects such as users, hosts, or certificates.
Procedure
- Open a terminal and connect to the IdM server.
To display a list of topics covered by help, run
ipa help topicscommand:ipa help topics
$ ipa help topicsCopy to Clipboard Copied! Toggle word wrap Toggle overflow To view documentation for a specific category, run the
ipa help <topic_name>command. Replace the<topic_name>placeholder with a category listed in the previous step. For example:ipa help user
$ ipa help userCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: To view long help output one screen at a time, pipe the command to the
lessutility:ipa help user | less
$ ipa help user | lessCopy to Clipboard Copied! Toggle word wrap Toggle overflow You can then scroll down and read the whole help.
The IPA CLI displays a help page for the
usertopic. After reading the overview, you can see many examples with patterns for working with topic commands.
3.5. Using IPA help commands Copier lienLien copié sur presse-papiers!
You can use ipa help commands to list every action supported by the Identity Management (IdM) server. You can also display required arguments and optional parameters for specific commands.
Procedure
- Open a terminal and connect to the IdM server.
To display a list of commands covered by help, run
ipa help commands:ipa help commands
$ ipa help commandsCopy to Clipboard Copied! Toggle word wrap Toggle overflow To view documentation for a specific command, run the
ipa help <command>command. Replace the<command>placeholder with a category listed in the previous step. For example:ipa help user-add
$ ipa help user-addCopy to Clipboard Copied! Toggle word wrap Toggle overflow
3.6. Structure of IPA commands Copier lienLien copié sur presse-papiers!
The IPA CLI uses a predictable structure that combines an object with a specific action. You can use this pattern to perform administrative tasks across different functional areas of IdM.
The IPA CLI distinguishes the following types of commands:
- Built-in commands — Built-in commands available on every IdM server.
- Plug-in provided commands — Extended functions provided by specific IdM modules.
For most IdM entries, the CLI follows a standard ipa <object>-<action> structure.
Common objects:
- Users
- Hosts
- DNS records
- Certificates
- And more.
For most of these objects, the IPA CLI includes commands to:
-
Add (
add) -
Modify (
mod) -
Delete (
del) -
Search (
find) -
Display (
show)
Commands have the following structure:
ipa user-add, ipa user-mod, ipa user-del, ipa user-find, ipa user-show
ipa host-add, ipa host-mod, ipa host-del, ipa host-find, ipa host-show
ipa dnsrecord-add, ipa dnsrecord-mod, ipa dnsrecord-del, ipa dnsrecord-find, ipa dnrecord-show
You can create a user with the ipa user-add [options], where [options] are optional. If you use just the ipa user-add command, the script asks you for details one by one.
Note that the [options] --raw and --structured are mutually exclusive and should not be run together.
To change an existing object, you must to define the object, therefore the command also includes an object: ipa user-mod <user_name>.
3.7. Using an IPA command to add a user account to IdM Copier lienLien copié sur presse-papiers!
Create new user entries in the Identity Management (IdM) database by using the IPA command-line interface (CLI).
Prerequisites
- You have administrator privileges.
Procedure
- Open a terminal and connect to the IdM server.
To add a user interactively, run the
ipa user-addcommand:ipa user-add
$ ipa user-addCopy to Clipboard Copied! Toggle word wrap Toggle overflow The command prompts you to provide basic data necessary for creating a user account.
- In the First name: field, enter the first name of the new user and press Enter.
- In the Last name: field, enter the last name of the new user and press Enter.
In the User login [suggested user name]: enter the user name, or just press Enter to accept the suggested user name.
The user name must be unique for the whole IdM database. If an error occurs because that user name already exists, repeat the process with the
ipa user-addcommand and use a different, unique user name.After you add the user name, the user account is added to the IdM database and the IPA command-line interface (CLI) prints the following output:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteBy default, the account does not have a password. To add a password while creating a user account, use the
ipa user-addcommand with the following syntax:ipa user-add --first=<user_name> --last=<user_surname> --password
$ ipa user-add --first=<user_name> --last=<user_surname> --passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow The IPA CLI then prompts you to add or confirm a user name and password.
If the user has been created already, you can add the password with the
ipa user-modcommand.
3.8. Using an IPA command to modify a user account in IdM Copier lienLien copié sur presse-papiers!
Update existing user attributes and security settings in the Identity Management (IdM) database by using the command-line interface. You can use the ipa user-mod command to modify parameters such as contact information, login shells, or passwords for any existing user account.
Prerequisites
- You have administrator privileges.
Procedure
- Open a terminal and connect to the IdM server.
To update a user account, run the
ipa user-mod <user_login>command and include the options for the attributes you want to change. Replace the<user_login>placeholder with the login name of the user:ipa user-mod <user_login> --password
$ ipa user-mod <user_login> --passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow If you used the
--passwordoption, provide the new password at the prompt and press Enter.The IPA CLI prints the following output. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The user password is now set for the account and the user can log into IdM.
3.9. Multi-valued attributes in IdM Copier lienLien copié sur presse-papiers!
Understand the syntax and overwrite logic for attributes that support multiple values in Identity Management (IdM). When you manage objects with multi-valued attributes, such as permissions or group memberships, you must provide the complete list of values during updates to prevent unintended data loss.
IdM supports the following methods of supplying multi-valued lists:
Using the same command-line argument multiple times within the same command invocation:
ipa permission-add --right=read --permissions=write --permissions=delete <object_name>
$ ipa permission-add --right=read --permissions=write --permissions=delete <object_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Alternatively, you can enclose the list in curly braces. The shell expands these into individual arguments before execution:
ipa permission-add --right={read,write,delete} <object_name>$ ipa permission-add --right={read,write,delete} <object_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
When you update such multi-valued attributes from the command line, IdM completely overwrites the previous list of values with a new list. Therefore, when updating a multi-valued attribute, you must specify the whole new list, not just a single value you want to add.
Examples of the overwrite logic
The following examples illustrate how the IdM database processes modifications to multi-valued attributes. During a modification, the absence of an existing value results in its removal from the record:
The
ipa permission-modcommand updates all previously added permissions:ipa permission-mod --right=read --right=write --right=delete <object_name>
$ ipa permission-mod --right=read --right=write --right=delete <object_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow or
ipa permission-mod --right={read,write,delete} <object_name>$ ipa permission-mod --right={read,write,delete} <object_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
ipa permission-modcommand deletes the--right=deleteargument because it is not included in the command:ipa permission-mod --right=read --right=write <object_name>
$ ipa permission-mod --right=read --right=write <object_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow or
ipa permission-mod --right={read,write} <object_name>$ ipa permission-mod --right={read,write} <object_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.10. Special characters in the IdM CLI Copier lienLien copié sur presse-papiers!
Handle shell-sensitive characters correctly to ensure command-line arguments are processed as intended. You can use the backslash (\) escape character to prevent the shell from misinterpreting special symbols within Identity Management (IdM) commands.
For example, to escape an asterisk (*):
ipa certprofile-show certificate_profile --out=exported\*profile.cfg
$ ipa certprofile-show certificate_profile --out=exported\*profile.cfg
Commands with unescaped special characters fail or produce unexpected results because the shell attempts to parse the characters as shell commands rather than literal text.