Manage users with the useradd command
Important
If you feel that Salt should be using this module to manage users on a minion, and it is using a different module (or gives an error similar to 'user.info' is not available), see here.
Add a user to the minion
Username LOGIN to add
User ID of the new account
Name or ID of the primary group of the new account
List of supplementary groups of the new account
Home directory of the new account
Login shell of the new account
If not True, the user account can have a non-unique UID
Create a system account
GECOS field for the full name
GECOS field for the room number
GECOS field for the work phone
GECOS field for the home phone
GECOS field for other information
Create the user's home directory
Login class for the new account (OpenBSD)
Do not add the user to the lastlog and faillog databases
Directory to chroot into
Create and add the user to a new primary group of the same name
CLI Example:
salt '*' user.add name <uid> <gid> <groups> <home> <shell>
Change the user's Full Name
User to modify
GECOS field for the full name
Directory to chroot into
CLI Example:
salt '*' user.chfullname foo "Foo Bar"
Change the default group of the user
User to modify
Force use GID as new primary group
Directory to chroot into
CLI Example:
salt '*' user.chgid foo 4376
Change the groups to which this user belongs
User to modify
Groups to set for the user
If True
, append the specified group(s). Otherwise, this function
will replace the user's groups with the specified group(s).
Directory to chroot into
CLI Examples:
salt '*' user.chgroups foo wheel,root
salt '*' user.chgroups foo wheel,root append=True
Change the home directory of the user, pass True for persist to move files to the new home directory if the old home directory exist.
User to modify
New home directory for the user account
Move contents of the home directory to the new location
Directory to chroot into
CLI Example:
salt '*' user.chhome foo /home/users/foo True
Change the user's Home Phone
User to modify
GECOS field for the home phone
Directory to chroot into
CLI Example:
salt '*' user.chhomephone foo 7735551234
Change the default login class of the user
User to modify
Login class for the new account
Directory to chroot into
Note
This function only applies to OpenBSD systems.
CLI Example:
salt '*' user.chloginclass foo staff
Change the user's other GECOS attribute
User to modify
GECOS field for other information
Directory to chroot into
CLI Example:
salt '*' user.chother foobar
Change the user's Room Number
CLI Example:
salt '*' user.chroomnumber foo 123
Change the default shell of the user
User to modify
New login shell for the user account
Directory to chroot into
CLI Example:
salt '*' user.chshell foo /bin/zsh
Change the uid for a named user
User to modify
New UID for the user account
Directory to chroot into
CLI Example:
salt '*' user.chuid foo 4376
Change the user's Work Phone
User to modify
GECOS field for the work phone
Directory to chroot into
CLI Example:
salt '*' user.chworkphone foo 7735550123
Remove a user from the minion
Username to delete
Remove home directory and mail spool
Force some actions that would fail otherwise
Directory to chroot into
CLI Example:
salt '*' user.delete name remove=True force=True
Get the login class of the user
User to get the information
Note
This function only applies to OpenBSD systems.
CLI Example:
salt '*' user.get_loginclass foo
Return the list of all info for all users
Force a refresh of user information
Directory to chroot into
CLI Example:
salt '*' user.getent
Return user information
User to get the information
Directory to chroot into
CLI Example:
salt '*' user.info root
Return a list of groups the named user belongs to
User to get the information
CLI Example:
salt '*' user.list_groups foo
Return a list of all users
Directory to chroot into
CLI Example:
salt '*' user.list_users
Return the primary group of the named user
New in version 2016.3.0.
User to get the information
CLI Example:
salt '*' user.primary_group saltadmin
Change the username for a named user
User to modify
New value of the login name
Directory to chroot into
CLI Example:
salt '*' user.rename name new_name