pub fn create_system_users(config: &HermeticParallelConfig) -> Result<(), Error>
Expand description
Creates system users and their integration.
Works on the UserMapping
s of the provided config
and creates system users for all
mappings, that define system users, if they don’t exist on the system yet.
System users are created unlocked, without passphrase, with their homes located in
HOME_BASE_DIR
.
The home directories of users are not created upon user creation, but instead a tmpfiles.d
configuration is added for them to automate their creation upon system boot.
Additionally, if an SshForceCommand
can be derived from the particular UserMapping
and
one or more SSH authorized_keys are defined for it, a dedicated SSH integration is created for
the system user.
This entails the creation of a dedicated authorized_keys file as well as an sshd_config
drop-in in a system-wide location.
Depending on UserMapping
, a specific ForceCommand is set for the system user, reflecting
its role in the system.
§Errors
Returns an error if
- a system user name (
SystemUserId
) in the configuration can not be transformed into a valid system user name [User
] - a new user can not be created
- a newly created user can not be modified
- the tmpfiles.d integration for a newly created user can not be created
- the sshd_config drop-in file for a newly created user can not be created