Built-in state module
The user module is used to create user and administrative user settings, and users can be set to a present state or absent state.
HWG: user.present: -fullname:jim -Shell:/bin/bash -Home:/HOME/HWG -uid:600 -Gid:600
-groups: -wheel -storage -Gamestestuser: user.absent
-
Salt.states.user. Absent (name, purge=false, force=false)
-
Absent state for deleting users
-
Name
-
With the deleted user name
-
Purge
-
Default is False, set to True to delete files that belong to this user group
-
Force
-
The default is False, which is set to true even if the user is deleted online
-
--------------------------------------------------
-
-
Salt.states.user. present (name, uid=none, gid=none, gid_from_name=false, groups=none, optional_groups=none, remove_groups=true, home=none, createhome=true, password=none, enforce_password=true, empty_password=false, shell=none , unique=true, system=false, fullname=none, roomnumber=none, workphone=none, homephone=none, loginclass=none, date=none, Mindays=none, maxdays=none, inactdays=none, warndays=none, expire=none )
-
-
Present state for creating and managing users
-
-
The properties are described below:
-
-
Name
-
-
User name, default user name is ID declaration
-
-
Uid
-
-
User ID, if not specified, uses the available ID sequentially
-
-
Gid
-
-
Default User group ID
-
-
Gid_from_name
-
-
The default is Fasle, which is set to True when the user group ID and user ID are the same
-
-
Groups
-
-
Adds the user to the specified group groups, specifies failure if the specified group does not exist, or if the specified group is empty, the user is removed from the other user group, only in its own user group
-
-
Optional_groups
-
-
Adds the user to the specified group groups, specifying ignore if the specified group does not exist
-
-
Note: If both groups and optional_groups specify a group, the group is considered required, not optional, and fails if the specified group does not exist.
-
-
Remove_groups
-
-
If the group is not specified in state and the user is a member of the group, the user is removed from the group, and the default is True
-
-
Home
-
-
User home Directory
-
-
Createhome
-
-
Default is True, set to False to not create home directory
-
-
Password
-
-
User password, only supported for Linux, FreeBSD, NetBSD, OpenBSD, and Solaris systems
-
-
Enforce_password
-
-
By default, the password is enforced, and if the password option is not present, the option is ignored, set to false, and the password is not modified if the hash password was previously set
-
-
Empty_password
-
-
The default is False, set to True, no password is logged in the user.
-
-
Shell
-
-
Specify shell, default to system default shell
-
-
Unique
-
-
Requirement is unique UID, default is True
-
-
System
-
-
Select UID between First_system_uid and last_system_uid, default = False
-
-
FullName
-
-
User's full name
-
-
Roomnumber
-
-
User Room Number
-
-
Workphone
-
-
User Work Phone
-
-
HomePhone
-
-
User Home Phone
-
-
Date
-
-
Specify the date the password was last modified
-
-
Mindays
-
-
Set the minimum number of days to modify a password
-
-
Maxdays
-
-
Maximum number of days to change password two times
-
-
Inactdays
-
-
Set the number of days to lock an account after the password expires
-
-
Warndays
-
-
Start warning days before setting password expiration
-
-
Expire
-
-
Set expiration date for account
-
-
-
-
-
-
-
-
-
User module of Saltstack