Servers & VPS

How to Upload Your Website to a VPS Server via FTP or SFTP

Learn how to transfer your website files to a VPS using FTP or SFTP, from setting up the server to uploading your first page.

Detailed view of Ethernet and VGA ports on a server highlighting connectivity features.

To upload your website to a VPS you can use SFTP (recommended, encrypted, runs over SSH) or install a traditional FTP server. Either way, the process has three steps: prepare the server, connect with a client, and copy your files. This guide covers both methods.

FTP vs SFTP: Which One Should You Use?

Before installing anything, choose the right protocol:

Feature Classic FTP SFTP
Encryption No (plaintext data) Yes (SSH channel)
Default port 21 22 (same as SSH)
Extra software on VPS Yes (vsftpd, ProFTPD…) No (built into OpenSSH)
NAT firewall compatibility Tricky (passive mode) No issues
Recommended for production No Yes

Bottom line: use SFTP whenever you can. If you need FTP for compatibility with a legacy CMS or client, install vsftpd with FTPS (FTP over TLS).

Method 1: Upload Files via SFTP

If your VPS already has SSH active (it does by default), SFTP works without installing anything extra.

Option A: GUI client (FileZilla)

  1. Download FileZilla (free, available for Windows, macOS, and Linux).
  2. Open the Site Manager (File → Site Manager).
  3. Click New Site and fill in:
    • Protocol: SFTP – SSH File Transfer Protocol
    • Host: your VPS public IP
    • Port: 22 (or whichever you've configured)
    • Logon type: Normal
    • User: your SSH username (e.g. ubuntu, root)
    • Password: your SSH password, or leave blank if using a key
  4. If you use an SSH key, go to Edit → Settings → SFTP in FileZilla and add your private key file (.pem or .ppk).
  5. Click Connect.
  6. In the right panel navigate to /var/www/yourdomain.com/html (or your web server's root path).
  7. Drag your files from the left panel (your PC) to the right panel (VPS).

Option B: Command line (sftp / scp)

From your local terminal, upload a single file:

scp -i ~/.ssh/my_key.pem index.html user@VPS_IP:/var/www/yourdomain.com/html/

Or upload an entire folder:

scp -r -i ~/.ssh/my_key.pem ./my-site/ user@VPS_IP:/var/www/yourdomain.com/html/

For an interactive SFTP session:

sftp -i ~/.ssh/my_key.pem user@VPS_IP
sftp> cd /var/www/yourdomain.com/html
sftp> put -r ./my-site/*
sftp> bye

Method 2: Install an FTP Server (vsftpd)

If you need classic FTP — for example, for a CMS that requires it — install vsftpd and configure it with FTPS.

Installation on Ubuntu/Debian

sudo apt update
sudo apt install vsftpd -y

Basic configuration

Edit /etc/vsftpd.conf and adjust these lines:

anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
pasv_enable=YES
pasv_min_port=40000
pasv_max_port=50000

Restart the service:

sudo systemctl restart vsftpd

Open the required ports in UFW:

sudo ufw allow 21/tcp
sudo ufw allow 40000:50000/tcp
sudo ufw reload

Create a dedicated FTP user

Never use root for FTP. Create a specific user for file transfers:

sudo adduser ftpuser
sudo mkdir -p /var/www/yourdomain.com
sudo chown ftpuser:ftpuser /var/www/yourdomain.com

File Permissions: The Detail That Trips Everyone Up

After uploading your files, the web server (Nginx or Apache) needs to read them. Set the correct permissions:

# Directories: 755 | Files: 644
sudo find /var/www/yourdomain.com -type d -exec chmod 755 {} \;
sudo find /var/www/yourdomain.com -type f -exec chmod 644 {} \;

If your web server runs as www-data (Ubuntu/Debian) or nginx (CentOS):

sudo chown -R www-data:www-data /var/www/yourdomain.com   # Debian/Ubuntu
sudo chown -R nginx:nginx /var/www/yourdomain.com         # CentOS/AlmaLinux

To view your site in a browser, make sure your Nginx or Apache server block points to that path. If you haven't configured your web server yet, browse our VPS server configuration tutorials before going further.

If you'd prefer to have professionals handle the initial setup, the team at elenlace.com can configure your full VPS environment and have it ready to receive your files in hours.

Key takeaways

  • SFTP is always the best option: no extra software needed on the VPS and all transfers are encrypted.
  • FileZilla is the simplest GUI client for SFTP connections on Windows, macOS, or Linux.
  • If you need classic FTP, install vsftpd with passive mode and FTPS to protect credentials.
  • Always create a dedicated user for file transfers; never use root directly.
  • Set file permissions (644) and directory permissions (755) after uploading to avoid 403 errors.

Want a VPS configured from scratch and ready to host your site today? Get in touch with elenlace.com and we'll have your environment up and running within hours.

FAQ

What is the difference between FTP and SFTP?

FTP transmits data in plain text (no encryption), which exposes your credentials and files on the network. SFTP uses the same encrypted channel as SSH, making it secure with no extra configuration. Use SFTP whenever possible.

Can I upload my website to a VPS without knowing Linux commands?

Yes. With a GUI client like FileZilla and SFTP access you can transfer files by clicking and dragging, without typing a single command. All you need is your VPS IP address, your username, and your SSH password.

Why do I get a 403 error after uploading my files?

A 403 error is almost always a permissions problem. Verify that directories have permission 755 and files have permission 644, and that the web server user (www-data or nginx) owns the files.

Can I automate uploads to my VPS?

Yes. You can use rsync over SSH to sync folders incrementally — only changed files are uploaded. For larger projects, a CI/CD pipeline (GitHub Actions, GitLab CI) automates deployment on every push to your repository.

Compare providers

Other providers and guides worth comparing:

← All