How to Connect to an SFTP Server

How to Connect to an SFTP Server

Last updated: August 2025 | 15 minute read

Have questions about how to connect to an SFTP Server?

Connecting to an SFTP server doesn’t have to be complicated. Whether you’re using command line tools, GUI applications like FileZilla or WinSCP, or integrating with cloud services like Azure Data Factory, this comprehensive guide will walk you through each method step-by-step.

If you’re looking for enterprise SFTP-to-the-cloud solutions involving AWS, Azure, or Google Cloud, check out our free white paper, “SFTP Gateway for the Enterprise.”

Table of Contents for “How to connect to an SFTP Server”

  1. What is SFTP and Why Use It?
  2. Connect via Command Line
  3. Connect Using FileZilla
  4. Connect Using WinSCP
  5. Connect in Azure Data Factory
  6. Common Connection Issues
  7. SFTP vs Other Protocols
  8. Enterprise SFTP Solutions

What is SFTP and Why Use It?

SFTP (SSH File Transfer Protocol) is a secure protocol for transferring files between systems. Unlike regular FTP, SFTP encrypts both commands and data, preventing passwords and sensitive information from being transmitted in clear text over the network.

Key Benefits of SFTP:

  • Encryption: All data is encrypted during transfer
  • Authentication: Supports both password and SSH key authentication
  • Firewall Friendly: Uses only one port (usually port 22)
  • Platform Independent: Works on Windows, Mac, and Linux

Method 1: Connect to SFTP Server via Command Line

Connecting to an SFTP server through command line is the most direct method and works on any operating system with SSH installed. SFTP commands operate on two filesystems simultaneously – the remote server you’re connected to and your local machine.

Quick Command:

sftp username@hostname

Step-by-Step Video Tutorial:

Watch our detailed walkthrough on connecting to SFTP via command line:

Basic Commands:

# Connect to SFTP server
sftp user@example.com

# Connect with custom port
sftp -P 2222 user@example.com

# Connect with SSH key
sftp -i ~/.ssh/private_key user@example.com

# Local filesystem commands (while in SFTP session)
lpwd # Show current local directory
lls # List local files
lcd directory # Change local directory
lmkdir dir # Create local directory
lrmdir dir # Remove local directory (if empty)
# Basic SFTP commands once connected
pwd              # Show current directory
ls               # List files
cd directory     # Change directory
get filename     # Download file
put filename     # Upload file
exit             # Disconnect

Pro Tips for Command Line SFTP:

  • Use -b batchfile to run multiple commands automatically
  • Add -v for verbose output when troubleshooting
  • Create an alias in your .bashrc for frequently accessed servers

Method 2: Connect to SFTP Using FileZilla

FileZilla is one of the most popular free SFTP clients, perfect for users who prefer a graphical interface.

Video Tutorial:

Learn how to connect to SFTP using FileZilla in this quick tutorial:

Quick Setup Guide:

  1. Download FileZilla from filezilla-project.org
  2. Open Site Manager (File → Site Manager)
  3. Configure Connection:
    • Protocol: SFTP – SSH File Transfer Protocol
    • Host: your.server.com
    • Port: 22 (or custom port)
    • Logon Type: Normal or Key file
    • User: your_username
    • Password: your_password
  4. Advanced Settings:
    • Transfer Settings → Limit simultaneous connections
    • Charset → Force UTF-8

FileZilla Pro Features:

  • Save multiple server profiles
  • Synchronized directory browsing
  • Filename filters
  • Transfer queue management
  • Remote file editing

Common FileZilla SFTP Issues:

  • “Connection timed out”: Check firewall settings
  • “Authentication failed”: Verify credentials or SSH key
  • “Host key verification failed”: Accept the host key on first connection

Method 3: Connect to SFTP Using WinSCP

WinSCP is a Windows-specific SFTP client known for its security features and scripting capabilities.

Video Tutorial:

Watch our complete guide on using WinSCP for SFTP connections:

WinSCP Setup Steps:

  1. Download WinSCP from winscp.net
  2. New Site Configuration:
    • File protocol: SFTP
    • Host name: your.server.com
    • Port: 22
    • User name: your_username
    • Password: your_password
  3. Advanced Options:
    • SSH → Authentication → Private key file
    • Environment → UTF-8 encoding
    • Transfer → Transfer mode: Binary

WinSCP Unique Features:

  • Windows Explorer Integration: Drag and drop files directly
  • Synchronization: Keep local and remote directories in sync
  • Scripting: Automate transfers with built-in scripting
  • PuTTY Integration: Seamless SSH terminal access

WinSCP Automation Example:

# WinSCP script example
open sftp://user:password@example.com/
cd /remote/directory
lcd C:\local\directory
put *.txt
exit

Method 4: Connect to SFTP in Azure Data Factory

For enterprise data integration scenarios, Azure Data Factory provides robust SFTP connectivity.

Video Tutorial:

Learn how to set up SFTP connections in Azure Data Factory:

Azure Data Factory SFTP Setup:

  1. Create Linked Service:
    • Type: SFTP
    • Host: your.sftpserver.com
    • Port: 22
    • Authentication: Basic or SSH public key
  2. Configure Dataset:
    • Format: DelimitedText, JSON, or Binary
    • Folder path: /your/remote/path
    • File name: Use wildcards for patterns
  3. Create Pipeline:
    • Add Copy Data activity
    • Source: SFTP dataset
    • Sink: Your destination (Blob, Data Lake, etc.)

Best Practices for ADF SFTP:

  • Use Key Vault for storing credentials
  • Implement retry policies for network issues
  • Set appropriate timeout values
  • Monitor with Azure Monitor

Common SFTP Connection Issues and Solutions

1. Connection Timeout

Error: “Connection timed out” Solutions:

  • Verify the server address and port
  • Check firewall rules (both client and server)
  • Test with telnet: telnet hostname 22
  • Try alternative ports if 22 is blocked

2. Authentication Failures

Error: “Permission denied (publickey,password)” Solutions:

  • Verify username and password
  • Check SSH key permissions (should be 600)
  • Ensure correct key format (OpenSSH vs PuTTY)
  • Verify user has SFTP access on server

3. Host Key Verification

Error: “Host key verification failed” Solutions:

  • Accept the host key on first connection
  • Update known_hosts file
  • Verify you’re connecting to the correct server

4. Transfer Errors

Error: “Transfer failed” or corrupted files Solutions:

  • Use binary transfer mode
  • Check disk space on both ends
  • Verify file permissions
  • Test with smaller files first

SFTP vs Other File Transfer Protocols

Feature SFTP FTP FTPS HTTP/HTTPS
Encryption ✅ Always ❌ No ✅ Optional ✅ HTTPS only
Port 22 21 + data 990/989 80/443
Firewall Friendly ✅ Single port ❌ Multiple ❌ Multiple ✅ Yes
Authentication Password + Keys Password Password + Cert Various
Platform Support ✅ All ✅ All ⚠️ Limited ✅ All

Enterprise SFTP Solutions

While the methods above work great for individual users and small teams, enterprises often need more robust solutions with features like:

  • High Availability: Clustered SFTP servers with failover
  • Audit Trails: Detailed logging for compliance
  • User Management: LDAP/AD integration
  • Automation: REST APIs and webhooks
  • Cloud Integration: Direct transfer to S3, Azure Blob, etc.

Introducing SFTP Gateway

For organizations looking to modernize their file transfers, SFTP Gateway provides a cloud-native solution that:

  • Deploys in minutes in your AWS, Azure, or Google Cloud account
  • Automatically syncs SFTP uploads to cloud storage
  • Scales seamlessly from 5 to 1,000+ users
  • Reduces costs by up to 70% compared to legacy solutions

Learn more about SFTP Gateway →

Connecting to SFTP servers is straightforward once you understand the basics, whether you’re using command-line tools, GUI applications like FileZilla or WinSCP, or cloud services like Azure Data Factory.

Any of the methods above will work perfectly for simple file transfers. For enterprise needs requiring high availability, compliance, and cloud integration, consider a managed solution like SFTP Gateway.

Next Steps with SFTP

Now that you know how to connect to an SFTP server:

  1. Choose your preferred method based on your operating system and needs
  2. Watch our video tutorials for visual step-by-step guides
  3. Test your connection with a sample file transfer
  4. Consider automation for repetitive transfers
  5. Explore enterprise solutions if managing multiple users
    1. For more information, get the free white paper, “SFTP Gateway for the Enterprise.”

Have additional questions about SFTP Gateway and how to connect to an SFTP server? Contact our support team at support@thorntech.com or start a free trial of SFTP Gateway. Want to learn more about SFTP? Check out, “What Port Does SFTP Use? A Complete Guide.

Get insights on SFTP Gateway, cloud computing and more, in your inbox.

Get smarter about all things tech. Sign up now!

Scroll to Top