- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Help with Perl Net::SFTP module
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-16-2007 02:14 AM
тАО03-16-2007 02:14 AM
I can use this package pretty well, except when I try to use a non-standard port number for the sftp server, instead of the default ssh number of 22, then it fails. I've attached the code segment and debug output below. Also, for the port number argument, I've tried both '563' and 563 - amazingly enough, they both end up having the same error, I thought I would have at least had a parameter data type problem before or after the change.
Example code:
#!/usr/bin/perl -w
use Net::SFTP;
use strict;
my $host = "someserver.com";
my %args = (
user => 'myusername',
password => 'mypassword',
port => 563,
debug => 'true'
);
# Make connection
my $sftp = Net::SFTP->new($host, %args);
My problem is that when I try to connect to this thing, - according to debug, it is still going to connect to port 22. Even stranger, it seems to communicate with the thing and swap id keys successfully, but it fails in the end...
Here is the debug output: *notice that on the third line, it says that it is connecting to port 22. Either it is ignoring my parmater and connecting to 22 by default and that's why it fails (no user account there), or this is just a "bug in debug" where it isn't really connecting to 22 at all, it just says it is?
Any suggestions appreciated.
svrA: Reading configuration data /home/someuser/.ssh/config
svrA: Reading configuration data /etc/ssh_config
svrA: Connecting to someserver.com, port 22.
svrA: Remote version string: SSH-2.0-OpenSSH_4.2
svrA: Remote protocol version 2.0, remote software version OpenSSH_4.2
svrA: Net::SSH::Perl Version 1.30, protocol version 2.0.
svrA: No compat match: OpenSSH_4.2.
svrA: Connection established.
svrA: Sent key-exchange init (KEXINIT), wait response.
svrA: Algorithms, c->s: 3des-cbc hmac-sha1 none
svrA: Algorithms, s->c: 3des-cbc hmac-sha1 none
svrA: Entering Diffie-Hellman Group 1 key exchange.
svrA: Sent DH public key, waiting for reply.
svrA: Received host key, type 'ssh-dss'.
svrA: Host 'someserver.com' is known and matches the host key.
svrA: Computing shared secret key.
svrA: Verifying server signature.
svrA: Waiting for NEWKEYS message.
svrA: Enabling incoming encryption/MAC/compression.
svrA: Send NEWKEYS, enable outgoing encryption/MAC/compression.
svrA: Sending request for user-authentication service.
svrA: Service accepted: ssh-userauth.
svrA: Trying empty user-authentication request.
svrA: Authentication methods that can continue: publickey,keyboard-interactive.
svrA: Next method to try is publickey.
svrA: Trying pubkey authentication with key file '/home/someuser/.ssh/id_dsa'
svrA: Authentication methods that can continue: publickey,keyboard-interactive.
svrA: Next method to try is publickey.
Permission denied at /usr/lib/perl5/site_perl/5.8.0/Net/SFTP.pm line 62
One more note: this is Perl 5.8.0, and I've installed the latest CPAN module and from there installed the latest Net::SFTP I could find on the mirrors.
Can anyone with a working Net::SFTP module in Perl try this too? Other ideas?
thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-16-2007 02:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-16-2007 05:01 AM
тАО03-16-2007 05:01 AM
Re: Help with Perl Net::SFTP module
That was exactly it! I'm guessing that the rest of the args other user, password, and debug had to live in a sub-list (sub-array).
This worked great, thank you very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-16-2007 05:14 AM
тАО03-16-2007 05:14 AM
Re: Help with Perl Net::SFTP module
my %args = (
user => 'myusername',
password => 'mypassword',
port => 563,
debug => 'true'
);
to
my %args = (
user => 'myusername',
password => 'mypassword',
debug => 'true',
ssh_args => [port => 563]
);
----------------------------------------
Final code looks like:
----------------------------------------
#!/usr/bin/perl -w
use Net::SFTP;
use strict;
my $host = "someserver.com";
my %args = (
user => 'myusername',
password => 'mypassword',
debug => 'true',
ssh_args => [port => 563],
);
# Make connection
my $sftp = Net::SFTP->new($host, %args);
----------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-16-2007 05:15 AM
тАО03-16-2007 05:15 AM
Re: Help with Perl Net::SFTP module
See comment above for fix.