SCP putting file problem

L

lerameur

hello,

I am getting an error while I am using the SCP put command:

here is the error:
Use of uninitialized value in die at ./spam_parsing.pl line 259,
<GEN2> line 2.
Died at ./spam_parsing.pl line 259, <GEN2> line 2.

from the line code 259:
$SCP->put("$file_to_put") or die SCP->{"errstr"};
print "Putting file and quitting \n";


It is logging in fine but the script exits when it reaches this
command.

I did put a print out to the "$file_to_put " file right before the
$SCP->put(".. line and it prints out fine, so the file is not a
problem.
anyone has an idea?

k
 
J

J. Gleixner

lerameur said:
hello,

I am getting an error while I am using the SCP put command:

here is the error:
Use of uninitialized value in die at ./spam_parsing.pl line 259,
<GEN2> line 2.
Died at ./spam_parsing.pl line 259, <GEN2> line 2.

from the line code 259:
$SCP->put("$file_to_put") or die SCP->{"errstr"}; ^$SCP
[...]
anyone has an idea?

Add the following to the top of your script:

use strict;
 
R

Ron Bergin

hello,

I am getting an error while I am using the SCP put command:

here is the error:
Use of uninitialized value in die at ./spam_parsing.pl line 259,
<GEN2> line 2.
Died at ./spam_parsing.pl line 259, <GEN2> line 2.

from the line code 259:
$SCP->put("$file_to_put") or die SCP->{"errstr"};

Shouldn't that be:
$SCP->put($file_to_put) or die $SCP->{errstr};
 
L

lerameur

I added
use strict;

here is the error message I am getting:
Can't use bareword ("SCP") as a HASH ref while "strict refs" in use
at ./spam_parsing.pl line 289.

k
 
R

Ron Bergin

I tried both with and without quote and I get the same error message

k

The quote is not the key issue. You forgot the $
Look closely at the difference between these:

die SCP->{"errstr"}
die $SCP->{"errstr"}
 
P

Paul Lalli

hello,

I am getting an error while I am using the SCP put command:

here is the error:
Use of uninitialized value in die at ./spam_parsing.pl line 259,
<GEN2> line 2.
Died at ./spam_parsing.pl line 259, <GEN2> line 2.

from the line code 259:
$SCP->put("$file_to_put") or die SCP->{"errstr"};


You need to reread the Net::SCP documentation better.
$scp->get("filename") or die $scp->{errstr};
$scp->put("filename") or die $scp->{errstr};


Paul Lalli
 
L

lerameur

You need to reread the Net::SCP documentation better.>Fromhttp://search.cpan.org/~ivan/Net-SCP-0.07/SCP.pm

$scp->get("filename") or die $scp->{errstr};
$scp->put("filename") or die $scp->{errstr};

Paul Lalli

well I fixed the perl problem, forgot the $ like Ron mentionned
I am faced with another problem

I am getting this error message. This is a non perl issue.

Permission denied (publickey,password,keyboard-interactive).

I followed the tutorial on this link:
http://rcsg-gsir.imsb-dsgi.nrc-cnrc.gc.ca/documents/internet/node31.html
and also from other post here a few days ago.
but I still get the error message.
I created a key in .ssh/id_rsa.pub and copy that into the .ssh/
known_hosts in the receiving server
any help appreciated
thanks
ken
 
L

lerameur

^^^^^^

You mean id_dsa.pub :)

I wouldn't like it if anyone had my private key...

Paul

well I do not see .ssh/authorized_keys but I do see /dir/.ssh/
known_hosts
I also have a directory /.ssh/known_hosts but this is root access
only and I tried puttingin both places my public key but that never
worked
k
 
J

Josef Moellers

lerameur said:
well I do not see .ssh/authorized_keys

If it's not there, it will be created by the '>>' redirection.
The sshd doesn't care whether the file exists and is empty or doesn't
exist. In both cases, no public keys from the client user exist and a
password will be requested.
 
C

comp.llang.perl.moderated

So? Just create one.

remote% cat >>.ssh/authorized_keys
<copy-and-paste the contents of id_rsa.pub here>
^D
remote% ls -l .ssh


Irrelevant; that file is not used for incoming connections.

<off topic>
That's true and I haven't used Net::SCP but, the scp could
potentially fail because the local ssh config forces a manual
acceptance check of the
remote host IP if there hasn't been an earlier
SSH connection. Once the connection is accepted,
the remote IP and its public key is added to
'known_hosts'.
</off topic>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top