Subject: | scp binary is hardcoded, cannot specify a different path to scp |
The scp binary used by the module is picked up from the user PATH. In
our case we have a default scp that won't work in some cases because
it was modified to authenticate using kerberos only. The fix is to
point to a stock scp in /usr/bin/scp but the script don't have a
option for that. A quick fix was to add the following to my code:
$ENV{'PATH'} = "/usr/bin:" . $ENV{'PATH'};
This solves the problem but is not very flexible. I added a scp_path
option that would fix that, allowing the user to say:
my $scpe = Net::SCP::Expect->new(user=> $user, password=> $pass,
auto_yes=> 1, scp_path=> "/usr/bin/scp");
I've attached the modified Expect.pm and a diff file.
Subject: | Expect.pm.diff |
47d46
< _scp_path => $arg{scp_path} || undef,
132d130
< my $scp_path = $self->_get('scp_path'); # Path to scp (paulo.santanna@morganstanley.com)
174,176d171
< # Use scp specified by the user if possible (paulo.santanna@morganstanley.com)
< $scp_path = "scp " unless (defined $scp_path);
<
181c176
< my $scp_string = "$scp_path $flags $from $to";
---
> my $scp_string = "scp $flags $from $to";
459,461d453
< B<scp_path> - The path for the scp binary to use. E.g.: /usr/bin/scp, defaults to use
< the first scp on your $PATH variable
<
Subject: | Expect.pm |
Message body is not shown because it is too large.