progfiguration.localhost.localusers¶
Local user and group management
Classes¶
Module Contents¶
- class progfiguration.localhost.localusers.GetentUserResult¶
-
- homedir: pathlib.Path¶
- class progfiguration.localhost.localusers.LocalhostUsers(localhost)¶
- add_service_account(username, primary_group, uid=None, primary_gid=None, groups=None, home=True, shell='/sbin/nologin') GetentUserResult ¶
Create a system user without a password and a primary group for it
- home: If True, create a homedir at the default location
If False, do not create a homedir If a string, treat it as a path to the homedir to be created
WARNING: Most arguments are not idempotent; if the user already exists, this will not change any of its attributes. However, it will add the user to any groups specified in the groups argument.
- add_group(groupname, gid=None, system=False)¶
Add a group
- add_user_to_group(username, groupname)¶
Add a user to a group
This is an idempotent operation with the adduser command
- user_exists(username)¶
Check if a user exists
- group_exists(groupname)¶
Check if a group exists
- getent_user(user)¶
Get the home directory of a user