- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: cannot login into the SFTP server using Net::S...
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
Forums
Discussions
Discussions
Discussions
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
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
10-30-2007 05:57 AM
10-30-2007 05:57 AM
we're using Public/Private Key authentication between SFTP client and server to trnasfer files.
I can login into SFTP server from my client linux machine without problems using this command:
# sftp user@server (without password)
but if i try to use a Net::SFTP perl script it doesn't work:
#!/usr/bin/perl -w
use strict;
use warnings;
use Net::SFTP;
my $server="X.X.X.X";
my $user="myuser";
my $password="";
my %args = (user => "$user", password => "$password", ssh_args => [port => 22]);
my $file="TEST.CSV";
my $sftp=Net::SFTP->new($server, %args);
$sftp->put($file);
exit;
I get the following error:
# perl test.cgi
Use of uninitialized value in concatenation (.) or string at /usr/local/share/perl/5.8.8/Net/SFTP.pm line 245.
Couldn't get handle: No such file or directory at test.cgi line 20
howto solve this problem ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2007 06:41 AM
10-30-2007 06:41 AM
Re: cannot login into the SFTP server using Net::SFTP
$sftp->put($file);
and the complaint is "No such file or
directory", then I'd want to know if there
really is a "TEST.CSV".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2007 07:05 AM
10-30-2007 07:05 AM
Re: cannot login into the SFTP server using Net::SFTP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2007 07:14 AM
10-30-2007 07:14 AM
Re: cannot login into the SFTP server using Net::SFTP
A transcript showing "ls -l" output would be
much more persuasive than your opinion/claim.
Evidence that you're looking at the same
directory as the script would also be nice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2007 07:17 AM
10-30-2007 07:17 AM
Re: cannot login into the SFTP server using Net::SFTP
total 300
drwxr-xr-x 5 root root 4096 2007-10-30 20:15 .
drwxr-xr-x 28 root root 4096 2007-10-30 19:37 ..
-rw-r--r-- 1 root root 113280 2007-10-30 11:30 libmath-pari-perl_2.010709.orig.tar.gz
-rw-r--r-- 1 root root 9465 2007-10-29 20:31 libnet-sftp-perl_0.10-1.diff.gz
-rw-r--r-- 1 root root 392 2007-10-29 20:31 libnet-sftp-perl_0.10-1.dsc
-rw-r--r-- 1 root root 24676 2007-10-29 20:30 libnet-sftp-perl_0.10.orig.tar.gz
drwxrwxrwx 9 root root 4096 2007-10-30 11:30 Math-Pari-2.010709
drwxr-xr-x 7 500 500 4096 2007-10-30 11:31 Net-SFTP-0.10
drwxr-xr-x 6 linux linux 4096 2007-10-30 11:25 Net-SSH-Perl-1.24
-rw-r--r-- 1 root root 92276 2007-10-30 11:22 Net-SSH-Perl-1.24.tar.gz
-rw-r--r-- 1 root root 4233 2007-10-30 17:55 sftp.cgi
-rw-r--r-- 1 root root 4210 2007-10-30 11:47 sftp_old.cgi
-rw-r--r-- 1 root root 399 2007-10-30 20:14 test.cgi
-rw-r--r-- 1 root root 22 2007-10-29 14:13 TEST.CSV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2007 07:38 AM
10-30-2007 07:38 AM
Re: cannot login into the SFTP server using Net::SFTP
# sftp myuser@X:X:X:X
Connecting to X:X:X:X...
sftp> put TEST.CSV
Uploading TEST.CSV to /HOME/TEST.CSV
TEST.CSV 100% 22 0.0KB/s 00:00
#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2007 09:17 AM
10-30-2007 09:17 AM
Re: cannot login into the SFTP server using Net::SFTP
$sftp->put($file, $file) or die "could not upload a file\n";
greetings
chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2007 01:49 AM
10-31-2007 01:49 AM
SolutionThough I never have used this module Net::SFTP a quick look at its POD already in the SYNOPSIS section revealed that the module's put method requires at least two args, viz. local and remote file name.
http://search.cpan.org/~dbrobins/Net-SFTP-0.10/lib/Net/SFTP.pm
Besides, this quoting of $user and $password shouldn't be necessary
my %args = (user => "$user", password => "$password",