Hello, I am trying to use Invoke-VMScript to run a specific command on Linux guest machines.
The command errors with the following output:
Invoke-VMScript : 29-10-2020 12:04:47 Invoke-VMScript | Failed to authenticate with the guest operating system usin |
g the supplied credentials.
At line:1 char:1
+ Invoke-VMScript -VM <REDACTED HOSTNAME> -ScriptText "sudo /bin/b ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo | : NotSpecified: (:) [Invoke-VMScript], InvalidGuestLogin | |
+ FullyQualifiedErrorId : Client20_VmGuestServiceImpl_RunScriptInGuest_ViError,VMware.VimAutomation.ViCore.Cm |
dlets.Commands.InvokeVmScript
In the linux host I'm currently trying I see the following in /var/log/audit/audit.log
type=USER_AUTH msg=audit(1603969482.812:4373542): pid=9477 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:authentication grantors=? acct="sa_vmware" exe="/usr/bin/vmtoolsd" hostname=? addr=? terminal=? res=failed'
/var/log/vmware-vmsvc.log shows the following during the login:
[2020-10-29T11:20:18.672Z] [ message] [vix] VixTools_ProcessVixCommand: command 181
[2020-10-29T11:20:20.256Z] [ warning] [VCGA] PAM error: Authentication failure (7), mapped to VGAuth error 12
[2020-10-29T11:20:20.256Z] [ warning] [vix] VixToolsImpersonateUser: impersonation failed (3050)
[2020-10-29T11:20:20.256Z] [ message] [vix] VixToolsCreateTempFileInt: opcode 181 returning 3050
[2020-10-29T11:20:20.256Z] [ message] [vix] ToolsDaemonTcloReceiveVixCommand: command 181, additionalError = 4294967284
/etc/pam.d/vmtoolsd Is the following:
auth required pam_shells.so
auth substack password-auth
auth include postlogin
account required pam_nologin.so
account include password-auth
with journalctl -xe I see
Oct 29 12:26:59 <REDACTED HOSTNAME> VGAuth[9477]: vmtoolsd: Username and password mismatch for 'sa_vmware'.
I am completely sure the password entered in the command is the same as the user password.
Moderator: Thread moved to the PowerCLI area.
You didn't show the complete Invoke-VMScript line.
Could it be that your password has special characters and was not between quotes?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The password does not have any special characters and I have tried it with and without quotes with no other result.
On previous mentions of this issue, a reinstall of the VMware Tools seems to have fixed the issue.
See PAM error when trying to Run Program in Guest t... |VMware Communities
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I reinstalled open-vm-tools.x86_64 and restarted the vmtools systemd service but no luck.
I'm out of ideas, but if you are willing to try it, give my Invoke-VMScriptPlus function a try.
With the Verbose switch, it might give some more information.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference