in reply to Re^6: Net-SFTP-Foreign: SSH slave exited unexpectedly with error code 255
in thread Net-SFTP-Foreign: SSH slave exited unexpectedly with error code 255

Warning: Identity file $keyfilepath not accessible: No such file or directory.

Again, it looks as if you where quoting too much or using the wrong set of quotes (single instead of double, or qw)... Ummm, I guess you are passing $keyfilepath as follows:

$sftp = Net::SFTP::Foreign->new(... more => [qw(-i $keyfilepath)], ...);
Instead, it should be...
$sftp = Net::SFTP::Foreign->new(... more => ['-i', $keyfilepath], ...);
It is probably working anyway because you have the private key in the standard place ~/.ssh/id_*

Replies are listed 'Best First'.
Re^8: Net-SFTP-Foreign: SSH slave exited unexpectedly with error code 255
by toohoo (Beadle) on Apr 10, 2015 at 12:50 UTC

    Sorry for that. I tried qq now, which isn't working too. In one case I have it to give 2 ssh-options in: (I'll try in your way to write it)

    more    => ['-i', $keyfilepath, '-o', 'StrictHostKeyChecking=no'],

    This now should work. Thanks again