User¶
- class rmote.tools.user.User[source]¶
Bases:
ToolManage users, groups, SSH keys, and sudoers on the remote host. Requires root.
- static absent(name, *, remove_home=False)[source]¶
Ensure a user does not exist. Returns True if user was removed.
- static authorized_key(name, key, *, exclusive=False)[source]¶
Ensure an SSH public key is present in ~/.ssh/authorized_keys.
- static group_absent(name)[source]¶
Ensure a group does not exist. Returns True if group was removed.
- Return type:
- static group_present(name, *, gid=None, system=False)[source]¶
Ensure a group exists. Idempotent.
- Return type:
- static present(name, *, uid=None, gid=None, comment='', home=None, shell='/bin/bash', groups=None, append_groups=True, system=False, create_home=True)[source]¶
Ensure a user exists with the given attributes. Idempotent.
- Parameters:
name (
Text) – Usernamecomment (
Text) – GECOS fieldhome (
Text|None) – Home directory path (default: /home/<name>)shell (
Text) – Login shellappend_groups (
bool) – If True, add to groups without removing existing onessystem (
bool) – Create as system user (no home, lower UID range)create_home (
bool) – Create home directory if it does not exist
- Return type: