Connect to ftp
Function: Connect to FTP
This function allows you to establish a secure connection to an FTP or SFTP server. Once connected, you can perform various file operations like uploading, downloading, or managing files and folders on the remote server.
Input,
- Protocol: (Selection) Choose the secure protocol for connection. Options are
SFTP
(Secure File Transfer Protocol) orFTPS
(FTP Secure).- Required: Yes
- Default: SFTP
- Authentication: (Selection) Select how you want to prove your identity to the server. Options are
Use a username & password to authenticate
orUse a public & private key to authenticate
.- Required: Yes
- Default: Use a username & password to authenticate
- Username: (Text) The username required to log in to the remote server.
- Required: No
- Password: (Password) The password associated with your username, or the passphrase for your private key if using public/private key authentication.
- Required: No
- Private key: (Password) The private key content used for authentication if you chose the public/private key method.
- Required: No
- Remote host: (Text) The address of the FTP/SFTP server (e.g.,
ftp.example.com
or an IP address).- Required: Yes
- Port: (Number) The port number on the remote server to connect to. Standard ports are 21 for FTP, 990 for FTPS (explicit), and 22 for SFTP.
- Required: No
- Remote directory: (Text) An optional starting directory on the remote server. If left empty, it connects to the root directory.
- Required: No
Output,
- Folder to read: (Folder) This output will hold the reference to the connected remote folder, allowing subsequent actions to interact with it.
- Default: FTP_FOLDER
- The status: (Status) This output will indicate the success or failure of the connection attempt. It will be "SUCCESS" if the connection is established, or "CONNECTION_FAILED" if there was an issue.
- Default: FTP_STATUS
Execution Flow,
Real-Life Examples,
Example 1: Connecting to an SFTP server with Username and Password
- Scenario: Your company uses an SFTP server to receive daily sales reports from a partner. You need to connect to this server to download the latest report.
- Inputs:
- Protocol:
SFTP
- Authentication:
Use a username & password to authenticate
- Username:
sales_partner
- Password:
MySecureP@ssw0rd
- Remote host:
sftp.partnercompany.com
- Port:
22
- Remote directory:
/daily_reports
- Protocol:
- Result: The function successfully connects to
sftp.partnercompany.com
on port 22, specifically to the/daily_reports
folder, using the provided username and password. TheFTP_FOLDER
output will contain a reference to this remote directory, andFTP_STATUS
will beSUCCESS
. You can then use other actions to list or download files from this folder.
Example 2: Connecting to an FTPS server to upload marketing materials
- Scenario: You need to upload new marketing brochures to your website's secure FTP server.
- Inputs:
- Protocol:
FTPS
- Authentication:
Use a username & password to authenticate
- Username:
webmaster
- Password:
WebM@sterPass
- Remote host:
ftp.mywebsite.com
- Port: (Leave empty, the system will use the standard FTPS port)
- Remote directory:
/public_html/marketing
- Protocol:
- Result: The function establishes a secure FTPS connection to
ftp.mywebsite.com
, logging in aswebmaster
and navigating to the/public_html/marketing
directory. TheFTP_FOLDER
output will be ready for further file operations, andFTP_STATUS
will beSUCCESS
.
Example 3: Connecting to an SFTP server using a Private Key for automated backups
- Scenario: An automated process needs to connect to a backup server via SFTP using a private key for enhanced security, without requiring a password.
- Inputs:
- Protocol:
SFTP
- Authentication:
Use a public & private key to authenticate
- Username:
backup_user
- Password: (Leave empty, as the private key is not passphrase-protected)
- Private key:
-----BEGIN RSA PRIVATE KEY-----\n... \(your base64 encoded key content\) ...\n-----END RSA PRIVATE KEY-----
- Remote host:
sftp.backupstorage.net
- Port:
22
- Remote directory:
/server_backups/database
- Protocol:
- Result: The function successfully connects to
sftp.backupstorage.net
using thebackup_user
and the provided private key, accessing the/server_backups/database
folder. TheFTP_FOLDER
output will be available for backup operations, andFTP_STATUS
will beSUCCESS
.