UnderHost
Knowledgebase Docs

SFTP guide: Secure file transfer via SSH | UnderHost

Learn SFTP (SSH File Transfer Protocol) for secure file uploads on VPS and dedicated servers. SFTP vs FTP comparison, FileZilla setup, security best practices. Note: SFTP requires SSH access (VPS/dedicated only).

On this page

SFTP (SSH File Transfer Protocol) is the secure way to transfer files to your hosting server. Unlike FTP, SFTP encrypts everything—your login credentials, file contents, and filenames—so your data stays private. It is the same secure connection as SSH but optimized for file transfers.

What is SFTP?

SFTP runs over SSH, the same encrypted tunnel used for command-line access. Instead of using a separate FTP connection (which is unencrypted), SFTP reuses SSH's security.

Key benefits:

  • Encrypted transmission - All data sent over secure connection
  • Safe credentials - Your password is never sent in plain text
  • File management - Upload, download, delete, rename, change permissions
  • No special port - Uses SSH port 22, easier through firewalls
  • Full shell access - Can also run commands on same connection

SFTP vs. FTP comparison

Feature FTP SFTP Recommendation
Encryption None (plaintext) Full SSH encryption Use SFTP
Password safety Exposed to network Encrypted (safe) Use SFTP
Port Port 21 (often blocked) Port 22 (usually open) SFTP better for firewalls
Setup difficulty Very easy Easy (same as SSH) About the same

Best practice: Always use SFTP. Never use FTP. If your hosting provider offers FTP, use SFTP instead.

Getting started with SFTP

SFTP requires SSH access (VPS/Dedicated only)

SFTP is only available on UnderHost VPS and Dedicated Servers. Shared hosting accounts do not have SSH/SFTP access. If you're on shared hosting and need to upload files, use regular FTP instead. To use SFTP, upgrade to a VPS or Dedicated Server.

What you need:

  • A UnderHost VPS or Dedicated Server (not shared hosting)
  • Your server IP address or hostname
  • Your root SSH username (usually "root")
  • Your SSH password (from welcome email)
  • SSH port (usually port 22)
  • An SFTP client (we recommend FileZilla - free)

Set up FileZilla for SFTP

Step 1: Download and install FileZilla

  1. Visit filezilla-project.org
  2. Download FileZilla Client (not Server)
  3. Install it (Windows/Mac/Linux versions available)
  4. Open FileZilla

Step 2: Configure SFTP settings

In the Site Manager window, fill in these fields:

  • Protocol: SFTP - SSH File Transfer Protocol (important!)
  • Host: Your server hostname (e.g., server1.underhost.com)
  • Port: 22 (standard SSH port)
  • User: Your SSH username (from cPanel account info)
  • Password: Your SSH password (usually your cPanel password)
  • Logon Type: Select "Normal"

Step 3: Connect

  1. Click Connect
  2. FileZilla will show a "Unknown host key" dialog (first time only)
  3. Click OK to accept the server's security certificate
  4. You are now connected!

Connect and transfer files

FileZilla layout:

  • Left side: Your computer (local files)
  • Right side: The server (remote files)
  • Bottom: Transfer queue and status

Uploading files to server:

  1. On the left (local), navigate to your files
  2. Drag and drop files to the right (server), OR
  3. Right-click on a file and select Upload
  4. Files appear in the transfer queue
  5. Wait for the transfer to complete

Downloading files from server:

  1. On the right (server), navigate to the file
  2. Drag and drop to the left (local), OR
  3. Right-click and select Download
  4. File appears in your local directory

SFTP security best practices

File permissions after upload:

After uploading files, verify permissions are correct:

  • PHP/CGI files: 644 or 755 (not 777)
  • Directories: 755
  • Sensitive files: 600 (your user only)

Never use 777 permissions as it allows everyone to modify your files.

Don't save passwords in FileZilla:

Uncheck "Save password" in Site Manager to prevent accidental password exposure.

Troubleshooting

"Connection refused"

Verify port is 22 (not 21, which is FTP), check that you selected SFTP protocol, and verify hostname spelling.

"Permission denied"

Verify username from cPanel account info (case-sensitive), check password hasn't been changed, and retype password carefully.

"Unknown host key"

This is normal on first connection. Click OK to accept the server's security certificate.

Related: SSH access basics | SSH key authentication | FTP basics | File permissions guide

Was this article helpful?

Need a developer-friendly server?

Use an UnderHost Cloud VPS for SSH, Git, Node.js, Python, Laravel, Docker, cron, and custom development workflows.

Related articles

Back to Developer Tools