4.4. Adding users and groups to an Image Builder blueprint in the web console interface
Adding customizations such as users and groups to blueprints in the web console interface is currently not possible. To work around this limitation, use the Terminal tab in web console to use the command-line interface (CLI) workflow.
- A blueprint must exist.
A CLI text editor such as
emacsmust be installed. To install them:
# yum install editor-name
- Find out the name of the blueprint: Open the Image Builder (Image builder) tab on the left in the RHEL 8 web console to see the name of the blueprint.
- Navigate to the CLI in web console: Open the system administration tab on the left, then select the last item Terminal from the list on the left.
Enter the super-user (root) mode:
$ sudo bash
Provide your credentials when asked. Note that the terminal does not reuse your credentials you entered when logging into the web console.
A new shell with root privileges starts in your home directory.
Export the blueprint to a file:
# composer-cli blueprints save BLUEPRINT-NAME
Edit the file BLUEPRINT-NAME.toml with a CLI text editor of your choice and add the users and groups.Importante
RHEL 8 web console does not have any built-in feature to edit text files on the system, so the use of a CLI text editor is required for this step.
For every user to be added, add this block to the file:
[[customizations.user]] name = "USER-NAME" description = "USER-DESCRIPTION" password = "PASSWORD-HASH" key = "ssh-rsa (...) key-name" home = "/home/USER-NAME/" shell = "/usr/bin/bash" groups = ["users", "wheel"] uid = NUMBER gid = NUMBER
Replace PASSWORD-HASH with the actual password hash. To generate the hash, use a command such as this:
$ python3 -c 'import crypt,getpass;pw=getpass.getpass();print(crypt.crypt(pw) if (pw==getpass.getpass("Confirm: ")) else exit())'
Replace ssh-rsa (…) key-name with the actual public key.
Replace the other placeholders with suitable values.
Leave out any of the lines as needed, only the user name is required.
For every user group to be added, add this block to the file:
[[customizations.group]] name = "GROUP-NAME" gid = NUMBER
- Increase the version number.
- Save the file and close the editor.
Import the blueprint back into Image Builder:
# composer-cli blueprints push BLUEPRINT-NAME.toml
Note that you must supply the file name including the
.tomlextension, while in other commands you use only the name of the blueprint.
To verify that the contents uploaded to Image Builder match your edits, list the contents of blueprint:
# composer-cli blueprints show BLUEPRINT-NAME
Check if the version matches what you put in the file and if your customizations are present.Importante
The Image Builder plugin for RHEL 8 web console does not show any information that could be used to verify that the changes have been applied, unless you edited also the packages included in the blueprint.
Exit the privileged shell:
Open the Image Builder (Image builder) tab on the left and refresh the page, in all browsers and all tabs where it was opened.
This prevents state cached in the loaded page from accidentally reverting your changes.