SFTP/SSH in webMethods using RSA

Hi all,

Basic Requirement:
To SFTP large files (usually 10GB). We use webMethods 6.1.2 (installed on Unix) as the orchstrator and make underlying Unix system calls to do the processing.
That is, if we have to SFTP a large file - webMethods will invoke a Perl script on the underlying Unix system and the Perl script inturn makes two things:

  1. Connect to the SFTP server (using the Unix system command “sftp user@hostname”) and get the “sftp>” prompt
  2. Transfer the file (using the command “put filename”)

Additional Requirement:
We use the RSA based passwordless authentication method provided by SSH/SFTP. We manually create a RSA pub-pvt key pair using “ssh-keygen” command and store the public key in the remotehost’s “.ssh/authorized_keys” file. While the pvt key is added to the “ssh-agent” on the localhost using the “ssh-add filename” command. More on this can be found at: http://www.securityfocus.com/infocus/1812 and http://www.openssh.com/manual.html

All the above had been working until the past few days. But there seems to have been some Unix env change because of which when webMethods calls the Perl script to do the sftp, it cannot contact the SSH Agent to get the pvt keys. There are several SSH Agents running in the system but the value of “SSH_AGENT_PID” is not available to the Perl script - because of which it cannot do a passwordless authentication with the remotehost. When we run the same script directly in Unix it succeeds but when webMethods calls this script it doesnt. When I run the “set” command through webMethods it doesnt have any Env Variables unlike when I run “set” command in Unix directly it gives me the variable list which has the value of “SSH_AGENT_PID” set. So when we run the Perl script using webMethods, it gives the error contacting the authentication agent :frowning:

Would appreciate greatly if we could get any inputs/help which could solve this issue. Possibly we may be doing something wrongly or missing something. But just to add - it all worked perfectly just a few days ago!


Hi sandeeppotdar,

If you are accessing environment variables you need to execute command (e.g. your perl script) via shell.

For example for Bourne shell and “set” command please try:

String[] cmd = {"sh", "-c", "set"};
Process p = Runtime.getRuntime().exec(cmd);

and let me know if this was the case.

Alternatively you could hard-code environment with method:

exec(String cmd, String[] envp)