in reply to Net::SSH::Expect login using SSH keys

You need to show some code to get proper response. Are you passing the user name while creating the Net::SSH::Expect object? Document says you need to pass user name even for public key authentication
# Note that when you use public-key authentication you won't need to s +et the 'password' constructor attribute # but you still need to define the 'user' attribute.

use Perl;
Perl4Everything

Replies are listed 'Best First'.
Re^2: Net::SSH::Expect login using SSH keys
by ashok.g (Beadle) on Dec 07, 2010 at 13:03 UTC
    print "$@"; $test = $ssh->read_line(); print "$test";

    Here $test is printing as Could not create directory '/var/www/.ssh'. on my browser.

    I tried with the ncoadmin (a non-root, existing system user). But the same error I'm getting when I tried to run this connection by sending the $rusr as 'blahblah'...

      What effective user is this script running under? Do they have permission to write to /var/www ?

      Net::SSH is just a wrapper around your local ssh command, so could this be an underlying permissions issue?

      Maybe Net::SSH::Perl is an option?

      Edited to correct links 20101207 @ 13:34 - CB
        I have changed the permission of /var/www to 777. Now I'm getting the error as

        The authenticity of host '192.168.1.181 (192.168.1.181)' can't be established.

        I can say that, the SSH is not happening with the user we are mentioning in the Net::SSH::Expect connection. It is always happening as apache (since it is trying to create a directory under /var/www).