Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

System call scp error 256

by srchulo (Sexton)
on Dec 05, 2011 at 00:10 UTC ( [id://941777]=perlquestion: print w/replies, xml ) Need Help??

srchulo has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I am running an scp command in my script to copy a file to a remote server. However, whenever I run it from a Perl script, I get a value of 256 returned and it does not work. Yet when I run the exact same command on the command line, I get a value of 0 returned and it works properly.

Does anyone have any idea what the issue could be? Here is the code that I am running:

my $result = `/usr/bin/perl /path/to/script/remote_copy.pl file=1323036682.png remotehost=otherserver localpath=/tmp/ remotepath=/path/to/images`;

remote_copy.pl is a script that just runs scp. Like I said, this exact command runs on command line, just does not work in Perl. I am working in a mod_perl environment if that helps at all.

Many thanks

srchulo

Replies are listed 'Best First'.
Re: System call scp error 256
by roboticus (Chancellor) on Dec 05, 2011 at 00:17 UTC

    srchulo:

    Usually the web server account has fewer permissions than a user account. Try running the script in a command line shell as the web server account to see what error message shows up. (Or just check the web logs.) Check directory permissions, environment variables, etc.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Thanks roboticus! It was a permissions error.

Re: System call scp error 256
by keszler (Priest) on Dec 05, 2011 at 00:53 UTC

    Does SCP return code 256 apply? If not, we'll likely need to see a listing of /path/to/script/remote_copy.pl.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-23 14:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found