| 1 |
.. _adding-users: |
| 2 |
|
| 3 |
Adding Users |
| 4 |
============ |
| 5 |
|
| 6 |
User accounts can be added or modified via the `users` element that |
| 7 |
supports a list of multiple `user` child elements: |
| 8 |
|
| 9 |
.. code:: xml |
| 10 |
|
| 11 |
<image schemaversion="{schema_version}" name="{exc_image_base_name}"> |
| 12 |
<users> |
| 13 |
<user |
| 14 |
password="this_is_soo_insecure" |
| 15 |
home="/home/me" name="me" |
| 16 |
groups="users" pwdformat="plain" |
| 17 |
/> |
| 18 |
<user |
| 19 |
password="$1$wYJUgpM5$RXMMeASDc035eX.NbYWFl0" |
| 20 |
home="/root" name="root" groups="root" |
| 21 |
/> |
| 22 |
</users> |
| 23 |
</image> |
| 24 |
|
| 25 |
Each `user` element represents a specific user to be added or modified. |
| 26 |
The following attributes are mandatory: |
| 27 |
|
| 28 |
- `name`: the UNIX username. |
| 29 |
|
| 30 |
- `password`: The password for the user account. It can be provided either |
| 31 |
in clear-text form (`pwdformat="plain"`) or in encrypted form |
| 32 |
(`pwdformat="encrypted"`). Using plain passwords is not advisable, as anyone |
| 33 |
with access to the image description can see the password. It is |
| 34 |
recommended to generate a hash of your password using `openssl` as |
| 35 |
follows: |
| 36 |
|
| 37 |
.. code:: bash |
| 38 |
|
| 39 |
$ openssl passwd -1 -salt 'xyz' YOUR_PASSWORD |
| 40 |
|
| 41 |
Additionally, the following optional attributes can be specified: |
| 42 |
|
| 43 |
- `home`: The path to the user's home directory. |
| 44 |
|
| 45 |
- `groups`: A comma-separated list of UNIX groups. The first element of the |
| 46 |
list is used as the user's primary group. The remaining elements are |
| 47 |
appended to the user's supplementary groups. When no groups are assigned, |
| 48 |
the system's default primary group will be used. |
| 49 |
|
| 50 |
- `id`: The numeric user ID of the account. |
| 51 |
|
| 52 |
- `realname`: The full name of the user. |
| 53 |
|
| 54 |
- `shell`: The login shell of the user. |
| 55 |
|
| 56 |
- `pwdformat`: The format in which `password` is provided, either `plain` |
| 57 |
or `encrypted` (the latter is the default). |