22.16.213. salt.modules.useradd

Manage users with the useradd command

salt.modules.useradd.add(name, uid=None, gid=None, groups=None, home=None, shell=None, unique=True, system=False, fullname='', roomnumber='', workphone='', homephone='', createhome=True)

Add a user to the minion

CLI Example:

salt '*' user.add name <uid> <gid> <groups> <home> <shell>
salt.modules.useradd.chfullname(name, fullname)

Change the user's Full Name

CLI Example:

salt '*' user.chfullname foo "Foo Bar"
salt.modules.useradd.chgid(name, gid)

Change the default group of the user

CLI Example:

salt '*' user.chgid foo 4376
salt.modules.useradd.chgroups(name, groups, append=False)

Change the groups this user belongs to, add append to append the specified groups

CLI Example:

salt '*' user.chgroups foo wheel,root True
salt.modules.useradd.chhome(name, home, persist=False)

Change the home directory of the user, pass true for persist to copy files to the new home dir

CLI Example:

salt '*' user.chhome foo /home/users/foo True
salt.modules.useradd.chhomephone(name, homephone)

Change the user's Home Phone

CLI Example:

salt '*' user.chhomephone foo "7735551234"
salt.modules.useradd.chroomnumber(name, roomnumber)

Change the user's Room Number

CLI Example:

salt '*' user.chroomnumber foo 123
salt.modules.useradd.chshell(name, shell)

Change the default shell of the user

CLI Example:

salt '*' user.chshell foo /bin/zsh
salt.modules.useradd.chuid(name, uid)

Change the uid for a named user

CLI Example:

salt '*' user.chuid foo 4376
salt.modules.useradd.chworkphone(name, workphone)

Change the user's Work Phone

CLI Example:

salt '*' user.chworkphone foo "7735550123"
salt.modules.useradd.delete(name, remove=False, force=False)

Remove a user from the minion

CLI Example:

salt '*' user.delete name remove=True force=True
salt.modules.useradd.getent(refresh=False)

Return the list of all info for all users

CLI Example:

salt '*' user.getent
salt.modules.useradd.info(name)

Return user information

CLI Example:

salt '*' user.info root
salt.modules.useradd.list_groups(name)

Return a list of groups the named user belongs to

CLI Example:

salt '*' user.list_groups foo
salt.modules.useradd.list_users()

Return a list of all users

CLI Example:

salt '*' user.list_users

Docs for previous releases are available on salt.rtfd.org.

Latest Salt release: 2014.1.13

Try the shiny new release candidate of Salt, v2014.7.0rc6! More info here.

Previous topic

22.16.212. salt.modules.upstart

Next topic

22.16.214. salt.modules.uwsgi

SaltStack News

Upcoming SaltStack events, webinars and local meet ups and user groups.