Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AddClusterUser
01-19-2017, 04:15 PM (This post was last modified: 04-04-2018 11:18 AM by rayluk.)
Post: #1
AddClusterUser
Create the user on each node with password-less SSH.

It can be run on any nodes in the TB/GM as root.
If the user already exists, it would check the uid, group id & group name are expected and consistent on all node.
It makes sure the user on all nodes have the same uid, group id & group name.
It must be run by root user, and root users on the nodes in ips can password-less SSH to each other.
If you want to use useradd/groupadd directly to create user/group, you should make sure the created uid/gid is not used in the whole cluster (such as in /etc/passwd, /etc/group). Besides, if the created uid/gid are in the range of [8000, 19999], you must record the created uid/gid in /thinker/globe/.think/clusteruser.pcf.

Usage:
AddClusterUser {--username|-u <USERNAME>} {--password|-p <PASSWORD>} [--uid <UID>] [--groupid <GID>] [--ips <ips file>]
AddClusterUser {--help|-h}
--username, -u: The name of the created user.
--password, -p: The password of the created user. If the user exists, the password would not be changed.
--uid: The user id of the created user. It must not be used in any node, or consistent on all nodes. If not specified, the tool would find an available uid automatically.
--groupid: The group id of the primary group of the created user. It must not be used in any node, or consistent on all nodes. If not specified, the tool would find an available group id automatically.
--ips: The node list of the cluster. Default value is /thinker/etc/ips.cfg.
--help, -h: Print this info.
It would infer uid & gid by:
(from high priority to low priority)
P1. The <UID> & <GID> in the options.
P2. The value of variable "user_<USERNAME>" and "group_<USERNAME>" in /thinker/globe/.think/clusteruser.pcf
P3. The value of variable "user_<USERNAME>" and "group_<USERNAME>" in /thinker/etc/soft/clusteruser/mic.pcf
P4. The max available uid & gid that are found on all nodes that are not used in /etc/passwd, /etc/group or the PCF files in P2 & P3.

Error Codes:
15: argument --username or --password is not specified.
16: ips file does not exist.
17: Do not have root permission.
18: User does not exist but group with the same name exists on some nodes.
20: Existed user info is not consistent.
21: uid is not expected.
22: groupid is not expected.
23: groupname is not expected.
Others are omitted.

Example:
AddClusterUser --username abc --password 123456

ID: 6545
Find all posts by this user
Quote this message in a reply
02-26-2017, 02:56 PM
Post: #2
RE: AddClusterUser
Pls specify important return status, e.g.,

If the user exists, AddClusterUser returns 18.
Find all posts by this user
Quote this message in a reply
02-26-2017, 03:06 PM (This post was last modified: 02-26-2017 03:07 PM by lingu.)
Post: #3
RE: AddClusterUser
Currently, user existing is considered an error. But this is a normal situation in many automated systems.

I suggest changing the following output message to be a warning or info, not an error mesage.

"ERROR: User gene already exists on 10.28.1.2."
Find all posts by this user
Quote this message in a reply
02-26-2017, 08:14 PM
Post: #4
RE: AddClusterUser
(02-26-2017 02:56 PM)lingu Wrote:  Pls specify important return status, e.g.,

If the user exists, AddClusterUser returns 18.

Added.

(02-26-2017 03:06 PM)lingu Wrote:  Currently, user existing is considered an error. But this is a normal situation in many automated systems.

I suggest changing the following output message to be a warning or info, not an error mesage.

"ERROR: User gene already exists on 10.28.1.2."

No.
It is not good for this case because AddClusterUser would also do some basic configuration such as password-less SSH and make sure the uid are same in all nodes.
When we feel it is necessary to do the same basic configuration for an existed account, we can improve the implementation of AddClusterUser to allow the existence of account, just like AddOpuser. Currently I do not find such necessary.
Find all posts by this user
Quote this message in a reply
06-30-2017, 04:49 PM
Post: #5
RE: AddClusterUser
Updated help info for optional ips files
Find all posts by this user
Quote this message in a reply
11-22-2017, 03:40 PM (This post was last modified: 11-22-2017 03:44 PM by lingu.)
Post: #6
RE: AddClusterUser
(01-19-2017 04:15 PM)YU_Xinjie Wrote:  Usage:
AddClusterUser {--username|-u <USERNAME>} {--password|-p <PASSWORD>} [--uid <UID>]

Our style for long option is to use = to specify the value of the option, like --username=abc. While using space is also often implemented, it is an additional feature, not a standard way. At present, AddClusterUser seems to support space but not =

Quote:[--groupid <GID>] [--ips <ips file>]
AddClusterUser {--help|-h}
--username, -u: The name of the created user.
--password, -p: The password of the created user. If the user exists, the password would not be changed.

If no password is specified, what is the behavior?

Quote: --uid: The user id of the created user. It must not be used in any node, or consistent on all nodes.

If no uid is specified, what is the behavior?
Find all posts by this user
Quote this message in a reply
11-22-2017, 03:50 PM
Post: #7
RE: AddClusterUser
(11-22-2017 03:40 PM)lingu Wrote:  Our style for long option is to use = to specify the value of the option, like --username=abc. While using space is also often implemented, it is an additional feature, not a standard way. At present, AddClusterUser seems to support space but not =

Added a TODO in http://tab.d-thinker.org/showthread.php?tid=6545

Quote:If no password is specified, what is the behavior?

password is a required option, which we have discussed and decided.
If it is not specified, nothing would be done and the return code would be 15.
Added the return code 15 description in headpost.

Quote:If no uid is specified, what is the behavior?

uid is an optional option.
The tool would find an available uid automatically.
Added the description into headpost.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: