开发者

Perl SCP ERROR(Asking to Continue?)

开发者 https://www.devze.com 2023-02-12 04:23 出处:网络
Here\'s is what I am doing my $username = \"user\"; my $password= \"pass\"; my $host=\"xxx.xxx.xxx.xxx\";

Here's is what I am doing

my $username = "user";
my $password= "pass";
my $host="xxx.xxx.xxx.xxx";

my $scpe =  Net::SCP::Expect->new(user => $username,
                                    password => $password,
                                    preserve => 1,
                开发者_JAVA百科                   recursive => 1,
                                  verbose=>1,
                  auto_yes=>1);

$scpe->scp("$file","$host:./drop/drop.txt");

When I run this code there is no error I am using unix box, $file is in my directory and have full permissions, also I have changed the directory to temp in unix box but when somebody else runs this code they get

Problem performing scp: Are you sure you want to continue connecting (yes/no)? at scp.pl line 242

I am very confused why is it happening, as this error is not received by me


Short answer:

Raise the timeout_auto value:

my $scpe =  Net::SCP::Expect->new(user => $username,
                                    password => $password,
                                    preserve => 1,
                                   recursive => 1,
                                  verbose=>1,
                                  timeout_auto=>10, #For example - 5 should probably be plenty
                  auto_yes=>1);

Long answer.

The

problem performing scp

is what Net::SCP::Expect prepends to the literal error message it gets from SCP itself, so in this case

Are you sure you want to continue connecting (yes/no)?

This usually happens because the host SCP is connecting to is not yet known.

You should set auto_yes to 1 if you want to avoid this error as the CPAN Documentation for NET::SCP::Expect explains, but I see you're already doing that.

If that doesn't help, consider raising the timeout_auto value. It defaults to 1 second, but if it takes longer for SCP to pose the 'are you sure' question (because for example the DNS looking of the host takes longer), it might not be enough.

0

精彩评论

暂无评论...
验证码 换一张
取 消