kicap has asked for the wisdom of the Perl Monks concerning the following question:
I have write some script that run Net::SFTP to transfer a file from my machine to the another machine...Here is the code...
===========================================#!/usr/bin/perl use Net::SFTP; #use strict; #use warnings; $host = $ARGV[0]; $anonyuser = $ARGV[1]; if($ARGV[1] eq "-a") { $username = "anonymous"; $password = "-anonymous@"; } else { print("\nHost\/IP: "); $host = <STDIN>; chomp ($host); print("\nUsername: "); $username = <STDIN>; chomp ($username); print("\nPassword: "); $password = <STDIN>; chomp ($password); } print("Connecting to $host...\n"); $ssh = Net::SFTP -> new($host) or die "Couldn't connect to $host\n"; print("Connected!\n"); print("\nSFC>"); $ssh->login($username, $password) or die "Could not log in .\n"; rep: $command = <STDIN>; chomp ($command); unless ("$command" eq "bye") { @listing = $ssh->$command; for($i=0;$i<@listing;$i++) { print "$listing[$i]\n"; + } print("SFC>"); #goto rep; }
It look ok...But at the end i got this message
Permission denied at /usr/lib/perl5/site_perl/5.8.0/Net/SFTP.pm line 3 +9
I don't know what's going on....i hope someone can help me
Janitored by davido: Added formatting and code tags.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::SFTP...permission denied
by tachyon (Chancellor) on Sep 13, 2004 at 07:05 UTC | |
by Anonymous Monk on Jan 02, 2005 at 10:50 UTC |