Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^6: Unable to connect to some SFTP servers using Perl::SFTP

by salva (Abbot)
on Apr 12, 2013 at 07:56 UTC ( #1028315=note: print w/ replies, xml ) Need Help??


in reply to Re^5: Unable to connect to some SFTP servers using Perl::SFTP
in thread Unable to connect to some SFTP servers using Perl::SFTP

The brackets are being intercepting by the shell. You have to properly quote shell metacharacters... actually, as there are two shells being invoked (the one used by perl to run your command and the one you are calling explicitly), you will have to double quote your arguments.

If you want to follow that route and need help about quoting I advice you to post a new question.


Comment on Re^6: Unable to connect to some SFTP servers using Perl::SFTP
Re^7: Unable to connect to some SFTP servers using Perl::SFTP
by skylinedreamer (Novice) on Apr 12, 2013 at 09:56 UTC
    Found a fix by using quotemeta(). Did that to all my parameters and its working. Thanks
    for($i = 0; $i <= $#fields; $i++) { $fields[$i] = quotemeta($fields[$i]); }
      Update:
      unless (fork()) { my $i; for($i = 0; $i <= $#fields; $i++) { $fields[$i] = quotemeta($fields[$i]); } #print $fields[0] ; system("gnome-terminal --title $fields[0] -x bash -c './uploader0.1.pl + $index @fields $file2send; echo Press any key to exit ...; read -n1' +"); exit(0); }
        Permission denied was solved by enabling keyboard interactive login. ssh_args was also passed to the sftp login as follows
        ## SFTP Connection my %args = (user => $user, password => $pass, debug => 1, ssh_args => { interactive => 1, identity_files => [ "/usr2/username/.ssh/id_rsa"], protocol=>'2,1' } ); my $sftp = Net::SFTP->new($host, %args) or do { print "Unable to connect to $name\n"; print "Aborting Connection\n"; goto END; };

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2014-12-28 20:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls