in reply to Expect OpenSSH sudo login is failing

The root password contains spaces and those spaces do appear to be getting escaped correctly

Spaces in the password shouldn't be escaped in any way! Or do you mean the prompt for the root password?

What I see is from the debugging output you have posted is that the remote systems doesn't like the root password you are passing

  • Comment on Re: Expect OpenSSH sudo login is failing

Replies are listed 'Best First'.
Re^2: Expect OpenSSH sudo login is failing
by archeman2 (Novice) on Apr 20, 2017 at 20:59 UTC

    Well since I am passing in several arguments, and the password contains spaces, that is where I'm using the escapes:

    In the example below, the final argument is the root password that contains spaces

    <blocktext>
    user@host:> perl perlscript.pl one two three four root\ pass\ word
    </blocktext>

    btw, I have tested the password when manually connected to the remote system and the password is correct

      I suspect that I may have found the root cause, at least it is 'kind of' working now that I have made the following change:

      [ qr/$rootpassword/ => sub { shift->send("$password\n");} ],

      Changed to:

      [ qr/$rootpassword/ => sub { shift->send("$rootpassword\n");} +],

      So it may have in fact been the wrong password