Re: [Ssh-sftp-perl-users] help needed for SFTP,SCP keys
Brought to you by:
dbrobins
|
From: Heiko J. <ja...@hb...> - 2008-07-14 07:04:23
|
Am Sonntag, den 13.07.2008, 23:32 -0700 schrieb Vikas Poonia:
> Thanks a lot for your help. The code for Scp keys is now working.
> Actually the problem was i was not able to use keys at my server. When
> i copied the public key to the server it si working fine now. TKs a
> lot again.
Did you even try to open a ssh session from your client to the server?
This is the most basic test and I really expected that you checked that
first.
> Now I want to implement SFTP by using the package Net::SSH2. Do u have
> any idea how we can do this I havent used it earlier.
The standard procedure would be to a) read the docs, b) check out the
tests in the Net::SSH2 package (~/t/Net-SSH2.t) for sample code and c)
try for yourself....
Heiko
> Thanks and Regrads
> Vikas Poonia
>
> Heiko Jansen <ja...@hb...> wrote:
>
> Am Mittwoch, den 09.07.2008, 21:58 -0700 schrieb Vikas Poonia:
> [...]
> > if ( $ssh2->auth_publickey( $user,
> > '/opt/mqm/home/kls_dev/.ssh/id_rsa.pub',
> > '/opt/mqm/home/kls_dev/.ssh/id_rsa' ) )
> > {
> > warn "Authentication succeeded\n" if $ssh2->auth_ok();
> > }
> > else {
> > die "Authentication failed! $!";
> > }
> > $ssh2->scp_get('/pkg/COBL/COBLxx72/users/kls_dev/vikas');
> > exit 0;
> >
> >
> > bash-3.00$ ./vik-te.pl
> > Authentication failed! Invalid argument at ./vik-te.pl line
> 35.
> > Net::SSH2::DESTROY object 0x22a6d0
> >
> > I dont khw why it is giving invalid argument. i have passed
> argument
> > as in the example. Can you please let me know some other
> way?
>
> a) Are you sure you really have the key files mentioned above?
> In your
> previous post you wrote:
> -- snip --
> Where Public key= '/opt/mqm/home/kls_dev/vikas/id.pub'
> and Private key = '/opt/mqm/home/kls_dev/vikas/id'
> -- / snip --
> Make sure the files you provide to the method really exist in
> the
> directory and with the name you mention. And of course it
> should be the
> same key pair from which you took the public key that you
> configured on
> the remote host.
>
> Also, please put in a line
> -- snip --
> warn "libbsh2 Status:\n" . join( "\n", $ssh2->error() );
> -- / snip --
> before the line
> -- snip --
> die "Authentication failed! $!";
> -- / snip --
> It provides the libssh2 error codes and messages.
>
> Heiko
|