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
user1:$6$OS4AKKev$zW4osKuZW6YEBwJt03lEPIxaYaN4d5.Ai2gz79ToYNiEIZsdkmO7qW1aTjKCzhlNvgRTwb31dGwyS/RW.4Zh.:16351:0:99999:7:::

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

vi-admin@vma:~[esxi02.vclass.local]> vicfg-user -e user -o list
USERS
-----------------
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