salt.states.user

Management of user accounts.

The user module is used to create and manage user settings, users can be set as either absent or present

fred:
  user.present:
    - fullname: Fred Jones
    - shell: /bin/zsh
    - home: /home/fred
    - uid: 4000
    - gid: 4000
    - groups:
      - wheel
      - storage
      - games

testuser:
  user.absent

Members

absent

salt.states.user.absent(name, purge=False, force=False)

Ensure that the named user is absent

name
The name of the user to remove
purge
Set purge to delete all of the user's file as well as the user
force
If the user is logged in the absent state will fail, set the force option to True to remove the user even if they are logged in

present

salt.states.user.present(name, uid=None, gid=None, groups=None, home=True, password=None, enforce_password=True, shell=None, fullname=None, roomnumber=None, workphone=None, homephone=None, other=None, unique=True, system=False)

Ensure that the named user is present with the specified properties

name
The name of the user to manage
uid
The user id to assign, if left empty then the next available user id will be assigned
gid
The default group id
groups
A list of groups to assign the user to, pass a list object
home
The location of the home directory to manage
password
A password hash to set for the user
enforce_password
Set to False to keep the password from being changed if it has already been set and the password hash differs from what is specified in the "password" field. This option will be ignored if "password" is not specified.
shell
The login shell, defaults to the system default shell

User comment field (GECOS) support (currently Linux-only):

The below values should be specified as strings to avoid ambiguities when the values are loaded. (Especially the phone and room number fields which are likely to contain numeric data)

fullname
The user's full name.
roomnumber
The user's room number
workphone
The user's work phone number
homephone
The user's home phone number
other
The user's "other" GECOS field
unique
Require a unique UID, True by default
system
Choose UID in the range of FIRST_SYSTEM_UID and LAST_SYSTEM_UID.

Parent topic

Table Of Contents

Previous topic

salt.states.sysctl

Next topic

salt.states.virtualenv