SFTP
This page explains the URL Adapter in Bridge context. If you were looking for the same information regarding the PAS Designer, refer to URL Adapter in the Designer guide.
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:
Option | Description |
---|---|
CURLOPT_SSH_AUTH_TYPES | Pass one of the following literals:
|
CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 | Pass 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_KEYPASSWD | Password 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:
Command | Description |
---|---|
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. |
pwd | The 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 Value | Description | Values | |
---|---|---|---|
protocol | Transport protocol. | sftp | |
method | SFTP method. | get, post, put, list | |
port | Machine port number the service is binding to. This port number can be given at service level only. | ||
path | SFTP path for the SOAP request. | ||
Advanced | |||
options | Native cURL options. | cURL Options | |
Authentication | |||
user | Username/password. | ||
Proxy | |||
proxyType | Type of the proxy. | HTTP, SOCKS5 | |
proxyURL | URL of the proxy server. | ||
proxyUser | Proxy user. |
SFTP Troubleshooting
Error | Possible Reason | Solution |
---|---|---|
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 |