Page tree
Skip to end of metadata
Go to start of metadata

Using the SFTP  (not to be confused with FTPS) protocol (see also http://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol) is very similar to FTP but there are some differences, most notable the options. If SFTP is used with private and/or public keys, the tagged value options on the deployment dependency must contain a string such as

CURLOPT_SSH_PRIVATE_KEYFILE=../resource/myPrivateKey CURLOPT_SSH_PUBLIC_KEYFILE=../resource/myPublicKey

Using the key pair myPrivateKey and myPublicKey allows you to access the server without having to authenticate the client (your E2E Bridge Service). The key files are uploaded to the resource repository using the E2E Bridge to upload mechanism. The key files are saved into the shared resources directory of the deployed service configuration.

The private and public key files must have the OpenSSH format. If you use puttygen to generate keys, the OpenSSH keys must get extracted because puttygen stores private and public keys into one file. A description how to do this can be found in the PuTTY User Manual.

Other supported SFTP options are:

OptionDescription
CURLOPT_SSH_AUTH_TYPESPass one of the following literals:
  • CURLSSH_AUTH_PUBLICKEY
  • CURLSSH_AUTH_PASSWORD
  • CURLSSH_AUTH_HOST
  • CURLSSH_AUTH_KEYBOARD
  • Set CURLSSH_AUTH_ANY to let the Bridge pick one. This is also the default.
CURLOPT_SSH_HOST_PUBLIC_KEY_MD5Pass a String of 32 hexadecimal digits. The string should be the 128 bit MD5 checksum of the remote host's public key. The Bridge will reject the connection to the host unless the md5 sums match. This option refers only for scp and sftp transfers.
CURLOPT_KEYPASSWDPassword protecting the private key file

Compared to FTP and FTPS, SFTP uses different commands. The following shows an extract of possible quote commands SFTP uses:

CommandDescription
chgrp <group file>The chgrp command sets the group ID of the file named by the file operand to the group ID specified by the group operand. The group operand is a decimal integer group ID.
chmod <mode file>The chmod command modifies the file mode bits of the specified file. The mode operand is an octal integer mode number.
chown <user file>The chown command sets the owner of the file named by the file operand to the user ID specified by the user operand. The user operand is a decimal integer user ID.
ln <source file> <target file>The ln and symlink commands create a symbolic link at the target file location pointing to the source file location.
mkdir <directory name>The mkdir command creates the directory named by the directory name operand.
pwdThe pwd command returns the absolute path name of the current working directory.
rename <source target>The rename command renames the file or directory named by the source operand to the destination path named by the target operand.
rm <file>The rm command removes the file specified by the file operand.
rmdir <directory>The rmdir command removes the directory entry specified by the directory operand, provided it is empty.

You can find a complete list of supported commands on the cURL haxx site.

Tagged Values

Find below a list of relevant tagged values, if the URL adapter is used with the SFTP protocol.
Default values used when an option is not explicitly set are written in bold.

Tagged ValueDescriptionValues
protocolTransport protocol.sftp
methodSFTP method.get, post, put, list
portMachine port number the service is binding to. This port number can be given at service level only. 
pathSFTP path for the SOAP request. 
Advanced
optionsNative cURL options.cURL Options
Authentication
userUsername/password. 
Proxy
proxyTypeType of the proxy.HTTP, SOCKS5
proxyURLURL of the proxy server. 
proxyUserProxy user. 

SFTP Troubleshooting

ErrorPossible ReasonSolution
Upload failed, error message: Operation failed (4/-31)The path is not correct.In SFTP, the path has to be set absolutely or using the tilde ( ~ ) for the user home path, e.g. /~/myPath/myfile
  • No labels