Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^7: sftp->do_write howto?

by insaniac (Friar)
on Sep 28, 2005 at 11:32 UTC ( [id://495704]=note: print w/replies, xml ) Need Help??


in reply to Re^6: sftp->do_write howto?
in thread sftp->do_write howto?

Hm... further investigations make me think there's a bug in Net::SSH::Perl or Net::SFTP.

try adding this to your code:

my %args = ( user => 'user', password => 'password', ssh_args => [ debug => 1, options => [ "PreferredAuthentications 'keyboard-interactive,password,h +ostbased,publickey'", ] ], );
and then:
eval { $sftp = Net::SFTP->new($host, %args) }; die "Connection failed: $!\n" if $!; die "No SFTP object\n" unless $sftp;
my output goes like:
wolf: Reading configuration data /home/insaniac/.ssh/config wolf: Reading configuration data /etc/ssh_config wolf: Connecting to bear, port 22. wolf: Remote protocol version 2.0, remote software version OpenSSH_4.2 +p1 Debian-4 wolf: Net::SSH::Perl Version 1.28, protocol version 2.0. wolf: No compat match: OpenSSH_4.2p1 Debian-4. wolf: Connection established. wolf: Sent key-exchange init (KEXINIT), wait response. wolf: Algorithms, c->s: 3des-cbc hmac-sha1 none wolf: Algorithms, s->c: 3des-cbc hmac-sha1 none wolf: Entering Diffie-Hellman Group 1 key exchange. wolf: Sent DH public key, waiting for reply. wolf: Received host key, type 'ssh-dss'. wolf: Host 'bear' is known and matches the host key. wolf: Computing shared secret key. wolf: Verifying server signature. wolf: Waiting for NEWKEYS message. wolf: Enabling incoming encryption/MAC/compression. wolf: Send NEWKEYS, enable outgoing encryption/MAC/compression. wolf: Sending request for user-authentication service. wolf: Service accepted: ssh-userauth. wolf: Trying empty user-authentication request. wolf: Authentication methods that can continue: publickey,keyboard-int +eractive. wolf: Next method to try is publickey. wolf: Trying pubkey authentication with key file '/home/insaniac/.ssh/ +id_dsa' wolf: Authentication methods that can continue: publickey,keyboard-int +eractive. wolf: Next method to try is publickey. Connection failed: No such file or directory

So when I try authenticating with an ssh-key, all works out perfectly. When I try to supply a username and a password, they seem to be ignored.. maybe we need to supply a specific value to ssh_args ?
Per default, Net::SFTP uses the username that's executing the script as SSH username...

I'll keep you informed if I find a solution...

Cheers, Johnny

to ask a question is a moment of shame
to remain ignorant is a lifelong shame

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://495704]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-19 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found