Hitachi Energy
Creation via Command Line
A shell script, ‘nemuser’, is provided to simplify host user creation in Linux. The script executes the “useradd” system call with the appropriate options to create the user with home directory in “/home”. The script is installed in
 
/opt/nem/bin
 
* 
Please note: 
You have to be “root” to perform some of the following actions, or, alternatively, use “sudo” if you have the permissions to do so.
 
Usage:
nemuser -a <-u user | -b backup_device [-f]> [-p parent_dir_for_home]
 
nemuser -r -u user
Options:
 
-a, --add
Add the user
-r, --remove
Remove the user (and the home directory)
-u, --user=USERNAME
Name of the user
-e, --enable-admin
Enable existing user as nem linux administrator
-d, --disable-admin
Remove existing user from nem linux administrators
-n, --no-prompt
Do not prompt to force logout user when -e or -d option is present
-b, --backup=FILENAME
Backup device or file name, where to extract user list from, by default only users having passwd file format entries will be taken, override this with the -f option.
-i, --inspect
Inspect backup file. Print nem users and nem admin users.
-f, --force-non-passwd-format-user
When used with –b option, forces to also add users without passwd file format entries. By default, the parent directory for these users will be /home. Override this with the –d option.
-p, --parent-directory=DIR
Parent directory for the user's home. Optional, default: '/home'.
When using –b and –f options this specifies the parent directory for those users not having a passwd file format entry in the user list.
-h, --help
Print this message.
Note:
Before using nemuser with the -b option show the user list using the following command:
su nemadm -c 'edbrestore -u -b nem.bkp'
Examples:
nemuser –a –u operator
Adds the user 'operator', creating home dir: /home/operator
 
 
nemuser –r –u operator
Removes the user 'operator'
 
 
nemuser –a –u operator –p /opt/nem
Adds the user 'operator', creating home dir: /opt/nem/operator
 
 
nemuser –a –b nem.bkp
Adds the users found in the specified NEM backup file, creating home dir: as defined in the backup
To complete the addition of the user, the password has to be entered with the command (example shown using sudo):
 
[admin@server ~]$ sudo passwd operator
Changing password for user nmsuser.
New password:
[enter password]
Retype new password:
[re-enter password]
passwd: all authentication tokens updated successfully.
A second script, ‘rbacuser’, is provided to manage role-based access control (RBAC) administrators. The script is installed in
 
/opt/nem/bin
 
 
Usage:
rbacuser -a user
rbacuser -r
rbacuser -g
 
Options:
-a user, --add=user
Add linux user to rbac administrators
-r, --reset
Reset initial rbac administrators
-g, --get
Get configured administrator
-h, --help
Print this help
You must be member of the nem group to execute the command.