Use saltstack to Manage Users

Source: Internet
Author: User
Tags saltstack


User. Present

User. Absent

Users. SLS

Using Salt for user management on multiple platforms will become very simple. The User Module allows the Administrator to manage and delete (absent) All aspects of the account. This article describes the components of the user module and provides an example of the state of the management account.


User. Present

User. Present: Make sure the specified account name exists and specify its corresponding attributes. These attributes include the following:


Name: Specifies the name of the account to be managed.


UID: indicates the UID. If this parameter is not set, a valid uid is automatically assigned.


GID: Specify the default group ID)


Gid_from_name: if it is set to _ true _, the default group ID is automatically set to the group ID with the same name as the user.


Groups: a list of groups assigned to the user ). if the group does not exist on Minion, this state will report an error. if this parameter is set to null, the user will be deleted from other groups except the default group.


Optional_groups: list of groups assigned to users. If the group does not exist on Minion, State ignores it.


Home: home directory ).


Password: Set the user's password after hash.


Enforce_password: when it is set to _ false _, if the _ password _ is different from the user's original password, the original password will not be changed. if the _ password _ option is not set, this option is automatically ignored.


Shell: Specifies the user's login shell. The default shell is set as the system default shell.


Unique: The UID is unique. The default value is true.


System: select a random uid between _ first_system_uid _ and _ last_system_uid.


The user description option (GECOS) is supported (currently only Linux and FreeBSD systems are supported ):


Fullname: Specifies the full name of a user ).


Roomnumber: Specifies the user's room number.


Workphone: Specifies the user's work phone number.


Homephone: Specifies the user's home phone number.


User. Absent

This part is supplemented by the translator according to the official manual, and there is no relevant content in the original article.

User. Absent is used to delete a user. It has the following options:


Name: Specifies the username to be deleted.


Purge: Set to clear User Files (Home Directory)


Force: if the user is currently logged on, the absent state will fail. If the _ force _ option is set to true, the user will be deleted even if the user is currently logged on.


When managing users, you must specify at least _ User. Present _ or _ User. Absent _. Other options are optional, such as _ uid _, _ GID _, and _ home.


Users. SLS

The following is an example of a State Declaration for the management _ cedwards _ User. the _ fullname _, _ SHELL _, _ home _, _ uid _, _ GID _, and _ groups _ columns are defined in this state:



Cedwards:

User. Present:

-Fullname: descrister Edwards

-Password: '$6 $ jyhdbioi5zyvadwm $. Taobao. c3enj32biwgcukt/y2awhl3w2plnlxjd9ghe/ftkkg348p8harxactived5uc /'

-Shell:/usr/local/bin/bash

-Home:/home/cedwards

-UID: 1001

-Gid: 1001

-Groups:

-Wheel


Jdoe:

User. Absent

(Although the password specified in this example is not my real password, it is not a good idea to use the hash string in this example)


This article is from the "davideylee" blog and will not be reposted!

Use saltstack to Manage Users

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.