Using SCP in Perl scripts in Epic

Help
2010-07-19
2013-05-20
  • Hi,
    I've been trying to run a Perl script that runs scp a few times from my Windows machine. The remote machine always asks for authentication for every file, which is annoying. To circumvent this problem, I set up ssh-agent through cygwin, so my password would just be stored and I'd only have to enter it once per session. This works great within Cygwin itself, but I can't get Epic or Eclipse to use ssh-agent the same way. Any ideas?

     
  • Jan Ploski
    Jan Ploski
    2010-07-19

    Do you mean that your Perl script works well when run from Cygwin bash shell, but not when run from EPIC? If so, some things that may differ (and which are under your control through Preferences and launch configuration) is (1) the Perl interpreter (2) the Perl interpreter's command-line arguments (3) environment variables. Another thing which differs is terminal emulation (which you don't have when running a script from EPIC and do have in a shell), but that should be irrelevant to your case.

     
  • Hi,
    That's exactly what I mean. Specifically, in Eclipse I get a password prompt for each file I try to SCP (indicative of ssh-agent not working properly, wince it should be supplying that password for me). I've already set the Perl interpreter to be the same one used by cygwin, and when I run the program in cygwin directly, it works fine without any command line arguments.

    That leaves your third suggestion about environment variables, which I think could be a likely culprit if Eclipse is not seeing environment variables used by ssh-agent like SSH_AGENT_PID and SSH_AUTH_SOCK. I see how I can give Eclipse absolute values for these in the run configuration, but is there a way to just make it see the same ones cygwin sees? I think that could likely solve the problem.

     
  • Jan Ploski
    Jan Ploski
    2010-07-19

    Environment variables are inherited by subprocesses. In your Cygwin direct scenario you have a bash.exe process interposed, which I think sets up your desired environment for the script. In the Eclipse scenario there is no bash.exe, hence the environment is inherited straight from Eclipse (and launch configuration). So your options are probably just limited to (1) use launch configuration tab (2) set environment variables globally or at least for the Eclipse process (somehow) (3) set them through ${ENV} within the script itself.