0

I am writing a VM deployment tool that needed to start VMs on an ESXi server. To do this I am using Perl's Expect module to spawn an ssh client to connect to the server and use vim-cmd to manage the VM.

When I did this I would see the connection and authentication succeed (i.e. the password prompt would be shown, the password accepted and then the prompt would be returned.

Immediately after that the ssh client process outputs "Connection to xxxx closed" and my script stops.

0

It turns out that I was setting 'raw_pty(1)' on the expect session:

  my $exp = new Expect();
  $exp->raw_pty(1);

  $exp->spawn("ssh", "$args{username}\@$server");

The raw_pty was not liked by the ESXi server and it immediately closed the connection. Removing the line:

  $exp->raw_pty(1);

fixed the problem I was having.

1
  • 1
    And what is the proper way to do it then? – GregL Feb 19 '16 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.