Error while executing command for user audit in NSX Manager CLI
search cancel

Error while executing command for user audit in NSX Manager CLI

book

Article ID: 375623

calendar_today

Updated On:

Products

VMware NSX VMware NSX Networking VMware NSX-T Data Center

Issue/Introduction

NSX Manager admin CLI returned error "Invalid value for argument <username>: audit" on every command execution for user audit.


NSX-Manager> get user audit ssh-keys 
Fri Oct 14 2022 UTC 10:44:48.224
Invalid value for argument <username>: audit

NSX-Manager> get user audit status
Fri Oct 14 2022 UTC 10:45:00.667
Invalid value for argument <username>: audit

NSX-Manager> get user audit password-expiration 
Fri Oct 14 2022 UTC 10:45:07.553
Invalid value for argument <username>: audit

Environment

NSX-T
NSX Data Center

Cause

Problem validation :

1. Go to NSX UI > System > User Settings > Local Users.

2. Ensure user 'audit' (User ID as 10002) status as Active.

3. Run admin CLI commands for user 'audit'. No error returned.

nsx-mngr-01> get user audit ssh-keys
Fri Oct 14 2022 UTC 03:03:54.005
No ssh-keys configured

nsx-mngr-01> get user audit status
Fri Oct 14 2022 UTC 03:04:32.252
Full name:
Username:  audit
Status:    ACTIVE

nsx-mngr-01> get user audit password-expiration
Fri Oct 14 2022 UTC 03:04:43.674
Password expiration not configured for this user

4. Switch to root to fetch user list. Confirm user 'audit' ID and its existence.

root@nsx-mngr-01:~# cat /etc/passwd | grep audit
audit:x:10002:10002::/home/audit:/opt/vmware/nsx-cli/bin/scripts/nsxcli_passwd

root@nsx-mngr-01:~# chage -l audit
Last password change                                    : Oct 14, 2022
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 99999
Number of days of warning before password expires       : 7

5. Delete user 'audit' using NSX manager root shell.

root@nsx-mngr-01:~# userdel audit

6. Validate user 'audit' existence.

root@nsx-mngr-01:~# cat /etc/passwd | grep audit

root@nsx-mngr-01:~# chage -l audit
chage: user 'audit' does not exist in /etc/passwd

7. User 'audit' no longer exists under NSX UI > System > User Settings > Local Users.

8. Run admin CLI commands for user 'audit'. Reported error can now be seen.

root@nsx-mngr-01:~# su admin -c get user audit status
Fri Oct 14 2022 UTC 03:48:20.854
% Invalid value for argument <username>: audit

root@nsx-mngr-01:~# su admin -c get user audit password-expiration
Fri Oct 14 2022 UTC 03:48:52.593
% Invalid value for argument <username>: audit

root@nsx-mngr-01:~# su admin -c get user audit ssh-keys
Fri Oct 14 2022 UTC 03:52:12.098
% Invalid value for argument <username>: audit


No additional users can be created. We cannot delete the default users, only deactivate the audit and guest user accounts.

Even if we deactivate user "audit" from NSX UI > System > User Settings > Local Users, user "audit" will still be listed as local user in NSX UI but as "Not activated ", until we would use "userdel audit" to delete user audit form root bash shell.

Only when you would have used "userdel audit" to delete user audit form root bash shell, you will not see user "audit" listed under NSX UI > System > User Settings > Local Users.

Resolution

It is not recommended to delete any local node users in any release prior to NSX 4.1.