Wednesday, October 8, 2014

Manipulating Users from the VMA

Adding users to an esxi host can be performed with one command from the VMA. The following command adds a user.

vi-admin@vma:~[esxi02.vclass.local]> vicfg-user -e user -o add -l user1 -p vmware1!
Created user user1 successfully.

That information can be viewed and verified from the esxi host by looking for the line containing user information in two files.

# grep user1 /etc/passwd
user1:x:1003:1003:ESXi User:/:/bin/sh

# grep user1 /etc/shadow

The users can be viewed from the VMA with the following command:

vi-admin@vma:~[esxi02.vclass.local]> vicfg-user -e user -o list
Principal -: root
Full Name -: Administrator
UID -: 0
Shell Access -:1

Principal -: dcui
Full Name -: DCUI User
UID -: 100
Shell Access -:0

--- the rest of the output was removed ---

The following command associates a user to a particular role (read-only in this case).

vi-admin@vma:~[esxi02.vclass.local]> vicfg-user -e user -o modify -l user1 --role read-only
Updated user user1 successfully.
Assigned the role read-only

The user can be deleted if necessary with one command.

vi-admin@vma:~[esxi02.vclass.local]> vicfg-user -e user -o delete -l user1
Removed the user user1 successfully.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.