net:scp Host key verification failed

net:scp Host key verification failed

am 12.10.2007 18:33:17 von lerameur

hello,

I am using ftp in perl script with no problem. I want to use SCP
instead of ftp but I am not having any luck. Do I need a key on the
receiving end??. The script uses the put command and gives me an error
when it cannot use this command:

.....
$SCP->cwd($directory) or $newerr=1; #getting into the directory
push @ERRORS, "Can't cd $!\n" if $newerr;
myerr() if $newerr;
$SCP->quit if $newerr;

$SCP->put("$file_to_put") or die $SCP->{errstr};
print "Putting file and quitting \n";

$SCP->quit;

Here the error message:
Connected
Getting file list
Logged in
unable to initialize mechanism library [/usr/lib/gss/gl/mech_krb5.so]
Host key verification failed.
lost connection

Re: net:scp Host key verification failed

am 12.10.2007 20:08:02 von glex_no-spam

lerameur wrote:
> hello,
>
> I am using ftp in perl script with no problem. I want to use SCP
> instead of ftp but I am not having any luck. Do I need a key on the
> receiving end??. The script uses the put command and gives me an error
> when it cannot use this command:
>
> ....
> $SCP->cwd($directory) or $newerr=1;

What is $SCP???.. I'm guessing it's Net::SCP, but yes
you need to set up the authorized_keys file appropriately on the
destination machine.

First, get ssh working from the command line, then
Net::SCP should work.

perldoc Net::SCP

FREQUENTLY ASKED QUESTIONS

Q: How do you supply a password to connect with ssh within a perl script
using the Net::SSH module?

A: You don't. Use RSA or DSA keys. See the ssh-keygen(1) manpage.

Re: net:scp Host key verification failed

am 12.10.2007 20:47:08 von lerameur

On Oct 12, 2:08 pm, "J. Gleixner"
wrote:
> lerameur wrote:
> > hello,
>
> > I am using ftp in perl script with no problem. I want to use SCP
> > instead of ftp but I am not having any luck. Do I need a key on the
> > receiving end??. The script uses the put command and gives me an error
> > when it cannot use this command:
>
> > ....
> > $SCP->cwd($directory) or $newerr=1;
>
> What is $SCP???.. I'm guessing it's Net::SCP, but yes
> you need to set up the authorized_keys file appropriately on the
> destination machine.
>
> First, get ssh working from the command line, then
> Net::SCP should work.
>
> perldoc Net::SCP
> in and getting a different error message:

> FREQUENTLY ASKED QUESTIONS
>
> Q: How do you supply a password to connect with ssh within a perl script
> using the Net::SSH module?
>
> A: You don't. Use RSA or DSA keys. See the ssh-keygen(1) manpage.

yes it is the net::scp module.
I tryed using ssh session manually, worked..Tried the ftp agained and
obtained a different error message:
how do I set the key properly

Connected
Getting file list
Logged in
unable to initialize mechanism library [/usr/lib/gss/gl/mech_krb5.so]
Permission denied (publickey,password,keyboard-interactive).
lost connection

Re: net:scp Host key verification failed

am 12.10.2007 21:11:48 von lerameur

On Oct 12, 2:47 pm, lerameur wrote:
> On Oct 12, 2:08 pm, "J. Gleixner"
> wrote:
>
>
>
> > lerameur wrote:
> > > hello,
>
> > > I am using ftp in perl script with no problem. I want to use SCP
> > > instead of ftp but I am not having any luck. Do I need a key on the
> > > receiving end??. The script uses the put command and gives me an error
> > > when it cannot use this command:
>
> > > ....
> > > $SCP->cwd($directory) or $newerr=1;
>
> > What is $SCP???.. I'm guessing it's Net::SCP, but yes
> > you need to set up the authorized_keys file appropriately on the
> > destination machine.
>
> > First, get ssh working from the command line, then
> > Net::SCP should work.
>
> > perldoc Net::SCP
> > in and getting a different error message:
> > FREQUENTLY ASKED QUESTIONS
>
> > Q: How do you supply a password to connect with ssh within a perl script
> > using the Net::SSH module?
>
> > A: You don't. Use RSA or DSA keys. See the ssh-keygen(1) manpage.
>
> yes it is the net::scp module.
> I tryed using ssh session manually, worked..Tried the ftp agained and
> obtained a different error message:
> how do I set the key properly
>
> Connected
> Getting file list
> Logged in
> unable to initialize mechanism library [/usr/lib/gss/gl/mech_krb5.so]
> Permission denied (publickey,password,keyboard-interactive).
> lost connection

I also ran the ssh-keygen -t rsa command.
This created a key on one server. I copied this key on the other
server, still do not work

k

Re: net:scp Host key verification failed

am 12.10.2007 22:10:13 von glex_no-spam

lerameur wrote:
[...]
> I also ran the ssh-keygen -t rsa command.
> This created a key on one server. I copied this key on the other
> server, still do not work

"Still do not work" isn't very helpful. How did you get it to work
on the command line?

Regardless, this isn't related to perl so I suggest you learn
about ssh/scp by searching/reading/trial and error/whatever and
post questions to a more appropriate ssh, scp, or OS related
newsgroup.

In short:

man ssh
man scp

Basically you copy the id_rsa.pub, or whatever public key
you created, to the destination machine, into that login's
$HOME/.ssh/authorized_keys2 file.

Then you should be able to test it by running "date" on
the remote host.

ssh remote.host.name date

if that works then scp will work.

scp file remote.host.net:remote_file_name

and Net::SCP should work.

Re: net:scp Host key verification failed

am 12.10.2007 22:16:00 von lerameur

On Oct 12, 4:10 pm, "J. Gleixner"
wrote:
> lerameur wrote:
>
> [...]
>
> > I also ran the ssh-keygen -t rsa command.
> > This created a key on one server. I copied this key on the other
> > server, still do not work
>
> "Still do not work" isn't very helpful. How did you get it to work
> on the command line?
>
> Regardless, this isn't related to perl so I suggest you learn
> about ssh/scp by searching/reading/trial and error/whatever and
> post questions to a more appropriate ssh, scp, or OS related
> newsgroup.
>
> In short:
>
> man ssh
> man scp
>
> Basically you copy the id_rsa.pub, or whatever public key
> you created, to the destination machine, into that login's
> $HOME/.ssh/authorized_keys2 file.
>
> Then you should be able to test it by running "date" on
> the remote host.
>
> ssh remote.host.name date
>
> if that works then scp will work.
>
> scp file remote.host.net:remote_file_name
>
> and Net::SCP should work.

ok good, I copied the key into the accepting server and it now works.

now I get an error when I am quitting:

Can't locate object method "quit" via package "Net::SCP" (perhaps you
forgot to load "Net::SCP"?) at ./ftptest.pl line 36.
line 36: $scp->quit;



this looks like a valid command from http://perldoc.net/Net/SCP.pm
there is also a nice tutorial on generating the keys at
http://rcsg-gsir.imsb-dsgi.nrc-cnrc.gc.ca/documents/internet /node31.html

k

Re: net:scp Host key verification failed

am 14.10.2007 13:06:22 von Joe Smith

lerameur wrote:

> now I get an error when I am quitting:
>
> Can't locate object method "quit" via package "Net::SCP" (perhaps you
> forgot to load "Net::SCP"?) at ./ftptest.pl line 36.
> line 36: $scp->quit;
>
> this looks like a valid command from http://perldoc.net/Net/SCP.pm
> there is also a nice tutorial on generating the keys at
> http://rcsg-gsir.imsb-dsgi.nrc-cnrc.gc.ca/documents/internet /node31.html
http://search.cpan.org/src/IVAN/Net-SCP-0.07/SCP.pm

Documentation error. There is no quit() method.

The last line of "#Net::FTP-style" in the SYNOPSIS should say
"There is no need to call a quit() method since the connection is not kept open."

-Joe