How to Set Up and Use SFTP with cPanel
Learn how to use SFTP with cPanel for encrypted website file transfers. Verify SSH access, find your hostname and port, configure FileZilla, WinSCP, Cyberduck, or another SFTP client, connect with a password or SSH key, manage files securely, and troubleshoot connection problems.
Secure File Transfer Protocol
SFTP (Secure File Transfer Protocol) transfers files between your computer and a web server using SSH. Unlike standard FTP, SFTP encrypts both data and credentials. Use it to upload content, run backups, or sync files on a cPanel server when SSH access is enabled.
Important: SFTP is a separate SSH protocol. A newly created cPanel FTP account does not automatically have SFTP access. SFTP normally uses the primary cPanel/SSH account (or another SSH-enabled system account) on port 22.
Why Use SFTP with cPanel?
Encryption
SFTP encrypts data and login credentials. Securing FTP Transfers
Single Port
Uses SSH, typically port 22, which is simpler for firewalls than FTP’s multiple data ports.
Authentication
Supports passwords or SSH keys. SSH Access Interface
Reliability
Stable transfers for large files, with resume support in many clients.
Prerequisites
- 1cPanel Access: URL, username, and password from your host.
- 2SSH Access: Confirm the host enables SSH/SFTP and note the port (commonly 22).
- 3SFTP Client: FileZilla, WinSCP, Cyberduck, or similar. Choosing the Right FTP Client
- 4Server Details: Hostname or IP, SSH username, and password or private key.
Step-by-Step Guide
Use this for FTP/FTPS with restricted directories. SFTP still requires an SSH-enabled account.
- In cPanel go to Files → FTP Accounts.
- Enter Log In, Domain, Password, Directory (e.g.,
public_html/subfolder), and Quota. - Click Create FTP Account. Create an FTP Account
- Go to Security → SSH Access.
- Click Manage SSH Keys, then Generate a New Key.
- Set Key Name (often
id_rsa), optional password, type (RSA), and size (2048 or 4096). - Click Generate Key. Download the public and private keys.
- Authorize the public key in cPanel.
- Store the private key securely (e.g.,
id_rsa.ppkfor FileZilla).
Tip: Key authentication avoids storing account passwords in the SFTP client.
FileZilla example:
- Install FileZilla from the official site.
- Open File → Site Manager (Ctrl+S).
- Create a new site: Protocol SFTP - SSH File Transfer Protocol, Host, Port 22, Logon Type Normal or Key File, User (cPanel/SSH username).
- Connect and accept the host key for a trusted server.
- Open
/home/user/public_htmland transfer files. Set Up FileZilla
- Upload/Download: Drag files between local and remote panes.
- Manage Files: Rename, delete, or set permissions (
644files,755directories). - Monitor Transfers: Use the queue to track progress and resume interrupted transfers.
Security Best Practices
- Use SSH Keys instead of passwords when possible.
- Restrict Directory Access on FTP/FTPS accounts. Create an FTP Account
- Monitor Connections in FTP Connections.
- Disable Anonymous FTP in cPanel’s Anonymous FTP interface.
Troubleshooting Common SFTP Issues
| Issue | What to Check |
|---|---|
| Connection Failures | Hostname, port 22, SSH username, and that SSH is enabled. |
| Authentication Errors | Key permissions (e.g., chmod 600 on the private key) and authorized public key in cPanel. |
| Directory Access Issues | The folder exists and permissions are correct (755 for directories). |
| Firewall Blocks | Port 22 must be open on the local network and server. |
| Slow Transfers | Connection quality and client transfer limits. |
cPanel Tools and Automation
Frequently Asked Questions
Why does my FTP client say authentication failed?
The username or password does not match the account. Extra cPanel users need the complete name@yourdomain.com login, and passwords are case-sensitive. Reset the password in FTP Accounts and try again. Do not use the SFTP protocol with an extra FTP user unless SSH is enabled for that account. Create or fix the login in an FTP account in cPanel.
What does “Failed to retrieve directory listing” mean?
The login often succeeded, but the data channel is blocked. In Site Manager set Passive mode for FTP or FTPS. Confirm explicit TLS and port 21. If listings still fail and SSH is available, switch that saved site to SFTP on port 22. FileZilla’s message log shows the exact reply. FileZilla steps are in FileZilla setup.
Why does SFTP time out when FTPS works?
FTPS uses the FTP service on port 21. SFTP uses SSH on port 22 and a different account type. A working FTPS login does not prove SSH is open. Check Security → SSH Access and the port your host assigned. Until SSH is enabled, keep using FTPS. See FTP vs SFTP vs FTPS and using SFTP with cPanel.
How do I fix “too many connections”?
Open Files → FTP Connections in cPanel and disconnect leftover sessions. In the client, limit simultaneous transfers to one and close extra windows. Several people sharing one login can hit the cap quickly. Give each person a separate extra account. Multi-user setup is in managing multiple FTP accounts.
Should I accept a certificate or host-key warning?
Accept it only when the hostname matches the server your host listed. FTPS certificates are often issued for the server name, not your domain. An SFTP host key on first connect is normal. If a saved site later shows a changed key, stop and confirm the address. Encryption terms are in encryption basics.
Can a workplace firewall block FTP?
Yes. Port 21 and FTP data ports are often filtered. Test from another network or a phone hotspot. If that works, stay on Passive FTPS or move to SFTP so only port 22 is required. File Explorer is especially fragile behind NAT because it leans on Active FTP. Explorer limits are in uploading files with File Explorer.
Why do uploads fail after I connect?
The folder may be wrong, the quota may be full, or chmod may block writes. Confirm you are in public_html or the extra user’s home directory. Check disk space and the FTP quota in cPanel. Use 644 for files and 755 for directories unless the app says otherwise. Account limits are in FTP user accounts explained.
Which client is easiest for diagnosing errors?
FileZilla and WinSCP both show a live log. Read the last few lines for 530, 425, or timeout messages before you change every setting. Update the client and save a Site Manager profile so tests stay consistent. Compare programs in choosing an FTP client, with more articles on the blog index.
FTP Tutorials and How-To Guides
Add Comment
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you agree with these rules:
- Although the administrator will attempt to moderate comments, not all comments can be moderated at all times.
- You acknowledge that all comments express the opinions of the original author and not those of the administrator.
- You will not post material which is knowingly false, obscene, hateful, threatening, harassing or invasive of privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Why Build it Yourself and DIY Websites can fail
Website Redesigning Strategy
How do I Create or Design a new Website
Designing Tips For Accessible Websites
Comments