How to set up and Use SFTP with cPanel

File Transfer Protocol - Secure File Transfer Protocol

For encrypted file uploads, following detailed guidance

Connect securely and manage your website efficiently

Updated: June 4, 2025
By: RSH Web Editorial Staff

Contact Us

Menu

Secure File Transfer Protocol

SFTP (Secure File Transfer Protocol) is a secure method for transferring files between your local computer and a web server, such as those managed through cPanel. Unlike standard FTP, SFTP uses SSH (Secure Shell) to encrypt both data and credentials, providing a high level of security for website management tasks like uploading content, performing backups, or syncing files. This guide provides step-by-step instructions to set up and use SFTP with cPanel, configure SSH keys for enhanced security, connect via popular SFTP clients, and troubleshoot common issues, ensuring seamless and secure file management.

Using SFTP with cPanel For secure file uploads with straightforward, detailed guidance

Why Use SFTP with cPanel?

SFTP is preferred over FTP due to its robust security features, making it ideal for managing website files in a cPanel environment. Key benefits include:

  • Encryption: SFTP encrypts both data and login credentials, protecting sensitive information from interception. Securing FTP Transfers with SFTP
  • Single Port: Operates over SSH (typically port 22), simplifying firewall configurations compared to FTP’s multiple ports.
  • Authentication Options: Supports password-based or SSH key-based authentication for enhanced security. SSH Access Interface
  • cPanel Compatibility: Integrates seamlessly with cPanel’s FTP accounts and SSH access, allowing secure file transfers to specific directories.
  • Reliability: Ensures stable transfers for large files or critical website updates, with resume capabilities in many clients.

According to cPanel’s documentation (2024), SFTP is recommended over FTP for its security advantages, especially when managing sensitive website data.

Prerequisites for Using SFTP with cPanel

Before setting up SFTP, ensure you have:

  • cPanel Access: Log in to your cPanel account using the URL, username, and password provided by your hosting provider
  • FTP Account: Create an FTP account in cPanel or use your primary cPanel account for SFTP access. How to Create an FTP Account
  • SFTP Client: Install an SFTP-compatible client like FileZilla, WinSCP, or Cyberduck. Choosing the Right FTP Client
  • SSH Access: Ensure your hosting provider enables SSH/SFTP access, as some may restrict it. Contact your host to confirm the SFTP port (typically 22).
  • Server Details: Obtain your server’s hostname (e.g., yourdomain.com), IP address, username, and password or SSH keys.

Note: cPanel supports only one SFTP account per user, tied to the cPanel account’s username, unless additional accounts are configured with restricted access.

Step-by-Step Guide to Using SFTP with cPanel

Step 1: Create an FTP Account (Optional)

If you prefer not to use your primary cPanel account for SFTP, create a dedicated FTP account:

  1. Log in to cPanel and navigate to Files → FTP Accounts.
  2. Under Add FTP Account, enter:
    - Log In: A username (e.g., newuser, becomes newuser@yourdomain.com).
    - Domain: Select the associated domain.
    - Password: Use a strong password or cPanel’s Password Generator.
    - Directory: Specify a directory (e.g., public_html/subfolder) to restrict access.
    - Quota: Set a limit or choose Unlimited.
  3. Click Create FTP Account. The account is now ready for SFTP use. Create FTP Account

Step 2: Enable SSH Access and Generate SSH Keys (Optional)

For enhanced security, use SSH keys instead of passwords for SFTP authentication:

  1. In cPanel, go to Security → SSH Access.
  2. Click Manage SSH Keys and select Generate a New Key.
  3. Enter:
    - Key Name: Default is id_rsa or use a custom name.
    - Password: Set a strong password (optional, depending on host settings).
    - Key Type: Choose RSA or DSA (RSA is common).
    - Key Size: Select 2048 or 4096 bits (4096 for higher security).
  4. Click Generate Key. Download the public and private keys from the .ssh folder to your local computer.
  5. Authorize the public key by clicking Manage and Authorize in cPanel.
  6. Save the private key securely (e.g., as id_rsa.ppk for FileZilla).

Tip: SSH key authentication eliminates the need to store passwords in SFTP clients, reducing security risks.

Step 3: Configure an SFTP Client

Connect to your cPanel server using an SFTP client. Below is an example using FileZilla, with references to other clients:

  1. Install FileZilla: Download from the official site. FileZilla
  2. Open FileZilla and select File → Site Manager (Ctrl+S).
  3. Click New Site, name it (e.g., “My Website”), and enter:
    - Protocol: SFTP - SSH File Transfer Protocol.
    - Host: Your server’s hostname (e.g., yourdomain.com) or IP address.
    - Port: 22 (or as specified by your host).
    - Logon Type:
    - Normal: Enter your cPanel/FTP username and password.
    - Key File: Browse to your private key file (e.g., id_rsa.ppk) if using SSH keys. FileZilla may prompt to convert the key format; click Yes and enter the key password if set.
    - User: Your cPanel/FTP username (e.g., user@yourdomain.com).
  4. In the Transfer Settings tab, select Passive mode for compatibility.
  5. Click Connect. Accept the host key prompt for trusted servers.
  6. Upon connection, navigate to your desired directory (e.g., /home/user/public_html) and transfer files by dragging and dropping. Set Up FileZilla

FTP and SFTP Clients:

  • FileZilla: Open-source, supports FTP/FTPS/SFTP
  • WinSCP: Windows-based, ideal for SFTP scripting
  • CoreFTP: Free, lightweight, and reliable FTP client
  • Fetch: A macOS FTP client, supports FTP/FTPS/SFTP
  • Commander One: macOS dual-pane client for FTP/SFTP
  • Cyberduck: Cross-platform, supports multiple protocols

Step 4: Transfer Files Securely

  • Upload/Download: Drag files between local and remote panes in your SFTP client.
  • Manage Files: Right-click to rename, delete, or adjust permissions (e.g., chmod 644 for files, 755 for directories).
  • Monitor Transfers: Use your client’s transfer queue to track progress and resume interrupted transfers.

Security Best Practices for SFTP

Maximize security when using SFTP with cPanel:

  • Use SSH Keys: Prefer key-based authentication over passwords to reduce credential exposure.
  • Restrict Directory Access: Configure FTP accounts to access only necessary directories (e.g., /public_html) to limit risks.
  • Monitor Connections: Use cPanel’s FTP Connections interface to track and terminate active sessions. FTP Connections Interface
  • Secure Hosting: Choose a provider like RSH Web Services with SSD hosting, free SSL, and DDoS protection.
  • Avoid Anonymous FTP: Disable anonymous FTP in cPanel’s Anonymous FTP interface to prevent unauthorized access. FTP Interface

Warning: The FBI (2023) highlighted vulnerabilities in unencrypted FTP; SFTP is critical for secure file transfers.

Troubleshooting Common SFTP Issues

Address common SFTP problems with these solutions:

  • Connection Failures: Verify hostname, port (typically 22), username, and credentials. Ensure SSH access is enabled by your host.
  • Authentication Errors: Check SSH key permissions (e.g., chmod 600 id_rsa) or ensure the public key is authorized in cPanel. cPanel SFTP Config
  • Directory Access Issues: Confirm the directory exists in cPanel’s File Manager and has correct permissions (e.g., 755 for directories).
  • Firewall Blocks: Ensure port 22 is open; contact your host or network admin to unblock it.
  • Slow Transfers: Optimize your internet connection or adjust client settings (e.g., FileZilla’s transfer limits).

Integrating SFTP with cPanel Features

cPanel enhances SFTP usage with tools for managing accounts and monitoring activity:

  • FTP Accounts: Create and manage SFTP-compatible accounts with restricted access. Create FTP Account
  • FTP Connections: Monitor active SFTP sessions and terminate suspicious connections. FTP Connections
  • Webalizer FTP: Analyze SFTP usage and track file transfer activity. Webalizer FTP
  • File Manager: Verify directories and permissions for SFTP access. File Manager

Automating SFTP Transfers

For repetitive tasks, automate SFTP transfers using scripts or client features:

  • WinSCP Scripting: Use scripts for automated backups or uploads. WinSCP Scripting
  • FileZilla CLI: Leverage FileZilla Pro’s command-line interface for automation. Automating File Transfers
  • Cron Jobs: Schedule SFTP tasks via cPanel’s Cron Jobs interface with SSH commands. Cron Jobs

By using SFTP with cPanel, you can securely manage your website files with confidence. Follow these steps, configure your preferred SFTP client, and implement security best practices to streamline your file transfer workflow.

cPanel Learning Resources and How-To Instructions
Industry leading Linux-based website hosting control panel

Tweet  Share  Pin  Email

Add Comment

* Required information
Drag & drop images (max 3)

Comments

No comments yet. Be the first!

Sparked by the creativity of our copy maestros

RSH Web Services hosting plans are carefully crafted to meet the needs and demands of all types of websites, from personal to business websites. we are committed to providing you with the best hosting services available in the industry