Module sysbot.modules.linux.users

Linux User Management Module

This module provides methods for managing and querying user and group information on Linux systems using the id and getent commands.

Classes

class Users

User and group management class for Linux systems.

Ancestors

Methods

def gid(self, alias: str, name: str, **kwargs) ‑> str

Get the primary group ID for a given user name.

Args

alias
Session alias for the connection.
name
User name to query.
**kwargs
Additional command execution options.

Returns

Primary group ID (GID) as a string.

def gids(self, alias: str, name: str, **kwargs) ‑> list

Get all group IDs for a given user name.

Args

alias
Session alias for the connection.
name
User name to query.
**kwargs
Additional command execution options.

Returns

List of group IDs the user belongs to.

def group(self, alias: str, **kwargs) ‑> list

Get the current user's group names.

Args

alias
Session alias for the connection.
**kwargs
Additional command execution options.

Returns

List of group names the current user belongs to.

def groups(self, alias: str, name: str, **kwargs) ‑> list

Get all group names for a given user name.

Args

alias
Session alias for the connection.
name
User name to query.
**kwargs
Additional command execution options.

Returns

List of group names the user belongs to.

def home(self, alias: str, name: str, **kwargs) ‑> str

Get the home directory for a given user name.

Args

alias
Session alias for the connection.
name
User name to query.
**kwargs
Additional command execution options.

Returns

Home directory path for the user.

def name(self, alias: str, **kwargs) ‑> str

Get the current user name.

Args

alias
Session alias for the connection.
**kwargs
Additional command execution options.

Returns

Current user name.

def shell(self, alias: str, name: str, **kwargs) ‑> str

Get the login shell for a given user name.

Args

alias
Session alias for the connection.
name
User name to query.
**kwargs
Additional command execution options.

Returns

Login shell path for the user.

def uid(self, alias: str, name: str, **kwargs) ‑> str

Get the user ID for a given user name.

Args

alias
Session alias for the connection.
name
User name to query.
**kwargs
Additional command execution options.

Returns

User ID (UID) as a string.