Back to Blog

FTP vs SFTP: How to Upload Files to a Server

FTP vs SFTP vs FTPS: the differences, uploading files to web hosting and servers with FileZilla and WinSCP, ports, SFTP-only users and common errors.

Nodesty Team5 min readHosting
The words FTP & SFTP with 21, 22 and FileZilla on a dark Nodesty background

FTP (File Transfer Protocol) is the protocol used to transfer files between your computer and a server. It's used to upload your website's files to hosting, send plugins to a game server or download logs from a server. Because plain FTP sends data without encryption, today it has largely given way to its secure versions: FTPS (FTP over TLS) and SFTP (SSH File Transfer Protocol).

This guide covers the differences between the three protocols, uploading files to web hosting and to your own server, FileZilla and WinSCP settings, creating a user who can only use SFTP and common errors.

The difference between FTP, FTPS and SFTP

FeatureFTPFTPS (FTP over TLS)SFTP
EncryptionNoneEncrypted with TLSEncrypted with SSH
Port21 plus data ports21 (explicit) or 990 (implicit)22 (the SSH port)
Server sideNeeds an FTP serverNeeds an FTP server with TLSOpenSSH is enough
Typical useLegacy systemsShared web hostingVPS, dedicated server, game server
FirewallNeeds passive portsNeeds passive portsA single port

Although the names are similar, SFTP is not a type of FTP; it's a completely different protocol that runs inside an SSH connection. In short:

  • On web hosting, use FTPS.
  • On your own server (VPS, dedicated server), use SFTP; you don't need to install anything extra.
  • Use plain FTP only if you have no other option.

FTP clients

To transfer files, you use a client program on your own computer:

  • FileZilla: Free for Windows, macOS and Linux; supports FTP, FTPS and SFTP.
  • WinSCP: Free for Windows; very capable with SFTP and lets you edit files on the server directly.
  • Cyberduck: A free client for macOS and Windows.
  • Command line: sftp, scp and rsync come built in on Linux and macOS, and on current versions of Windows too.

Uploading files to web hosting with FTPS

  1. Create an FTP account. Open an FTP account from FTP Accounts in cPanel or FTP Management in DirectAdmin, or use your main hosting account's details. You can restrict an account so it can only access a specific folder; this is handy when giving a developer temporary access.
  2. Set up the connection in FileZilla. Go to File → Site Manager → New Site and enter these details:
    • Protocol: FTP - File Transfer Protocol
    • Host: Your domain name or your hosting server's address
    • Encryption: Require explicit FTP over TLS
    • Logon Type: Normal
    • User and password: Your FTP account's details
  3. Upload the files to the right folder. The main domain's files go in the public_html folder. On the left you see the files on your computer, and on the right the files on the server; just drag and drop the files.

On the first connection, FileZilla may ask you to approve a certificate. If the name on the certificate matches the name of the server you're connecting to, approve it.

Connecting to your own server with SFTP

If you can connect to your VPS or dedicated server with SSH, SFTP is ready too:

  • Protocol: SFTP - SSH File Transfer Protocol
  • Host: Your server's IP address
  • Port: 22 (or the new port if you changed the SSH port)
  • Logon Type: Normal (password) or Key file

If you connect with an SSH key, set the logon type in FileZilla to Key file and select your private key; in WinSCP, point to the key under Advanced → SSH → Authentication. If needed, the programs offer to convert the key to their own format. We explain how to create an SSH key in our What is SSH? article.

For one-off transfers from the command line:

scp site.zip user@203.0.113.10:/var/www/
rsync -avz ./site/ user@203.0.113.10:/var/www/site/

Because rsync only sends files that have changed, it's the most efficient way to sync large folders.

A user who can only use SFTP

You may want to let a developer or client upload files only to a specific folder on your server, without giving them command-line access. OpenSSH can do this on its own:

  1. Create a group and a user:
    sudo groupadd sftpusers
    sudo useradd -m -g sftpusers -s /usr/sbin/nologin developer
    sudo passwd developer
    
  2. Prepare the folder the user will be jailed in. The root folder must be owned by root; the user can only write to a folder inside it:
    sudo mkdir -p /srv/sftp/developer/uploads
    sudo chown root:root /srv/sftp/developer
    sudo chown developer:sftpusers /srv/sftp/developer/uploads
    
  3. Add this to the end of the /etc/ssh/sshd_config file:
    Match Group sftpusers
        ChrootDirectory /srv/sftp/%u
        ForceCommand internal-sftp
        AllowTcpForwarding no
        X11Forwarding no
    
  4. Test the configuration and restart the SSH service:
    sudo sshd -t
    sudo systemctl restart ssh
    

When this user connects with SFTP, they only see their own folder and can't run commands over SSH. On some distributions, the service is called sshd instead of ssh.

Common errors

  • 530 Login incorrect: The username or password is wrong. Remember that for additional FTP accounts in cPanel, the username is in the form user@yourdomain.com.
  • Failed to retrieve directory listing or timeout: The data connection can't be established over FTP/FTPS. Make sure the transfer mode in FileZilla is Passive; if it's your own FTP server, open the passive port range in the firewall.
  • Connection refused (SFTP): The SSH service isn't running or you're connecting to the wrong port. If you changed the SSH port, change it in the client too.
  • Permission denied: The user doesn't have write permission for that folder. On Linux, check the folders' owner and permissions; 644 for files and 755 for folders are common values.
  • The files uploaded but the site didn't change: Make sure you uploaded to the right folder, and clear the browser or CDN cache.

We explain how ports work in our What is a port? article.

File transfer at Nodesty

On Nodesty web hosting plans, you can create FTP accounts through cPanel or DirectAdmin and upload your files securely with FTPS, or use the control panel's file manager; for security reasons, SSH and SFTP access aren't offered on shared servers. On AMD Ryzen 9 9950X VPS plans, you can connect to your Linux server with SSH and SFTP, or to Windows Server with Remote Desktop, and transfer your files directly.

Frequently Asked Questions

Is FTP secure?

Plain FTP sends your username, password and files without encryption; someone on the same network can read this information. That's why you should always use FTPS (FTP over TLS) or SFTP instead of plain FTP. FTPS is the most practical choice on web hosting, and SFTP on your own servers.

What is my FTP username?

The username for additional FTP accounts you create in cPanel and DirectAdmin is usually in the form user@yourdomain.com. If you connect with the main hosting account, you use your account username. You can see the correct format in the FTP accounts section of your control panel.

Do I need to install a separate program for SFTP?

Not on the server side. SFTP is part of OpenSSH, which is already installed on Linux servers, and you can connect with SFTP to any server you can reach with SSH. On your own computer, you use a client such as FileZilla, WinSCP or Cyberduck.

Can I use SFTP on web hosting?

SFTP runs over SSH. On shared web hosting plans that don't offer SSH access, you upload your files with FTPS (FTP over TLS) or the file manager in the control panel. Nodesty web hosting plans don't include SSH access, so we recommend using FTPS.

Why don't the files I uploaded show up on the site?

Most likely you uploaded the files to the wrong folder. On web hosting, the main domain's files go in the public_html folder; addon domains and subdomains have their own folders. A browser or CDN cache may also still be showing the old files.

How do I upload lots of small files quickly?

Sending thousands of small files one by one is slow, because each file needs a separate operation. Put the files into a single zip archive first and upload it, then extract it with the control panel's file manager or with the unzip command on the server.

Nodesty

About the author

Nodesty Team · Infrastructure & Support

The Nodesty team runs our servers, network and DDoS protection day to day and answers customer support requests around the clock. These guides come from that work.

Related articles

Launch your server now.

Build, scale, and conquer without limits on Nodesty's premium infrastructure.

                                                                                                                                                                                                                            
                                                                                                                                                                                                                            
                                                                                                                                                                                                                            
                                                                                                                             ············································                                                   
                                                ··································································································..........···························                                     
                                       ················..........................................................................................................................··············                             
                                  ·············.................::::::::::::::::::::::::::::::::::::::::::::::....................:::::::::::::::::::::::::::::::::::::::................···········                        
                             ············................:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::............·········                     
                         ············.................:::::::::::::::::::::::::::::::::::::::::::::::::::------------::::::::::::::::::::::::::::::----------------:::::::::::::::::::::..........········                  
                    ············......................::::::::::::::::::::::::::::::::::::------------------------------------------------------------------------------------:::::::::::::.........········                
                ··········.............................................::::::::::::::::::-------------==========================================-----------------------------------:::::::::::........·······               
             ········..................:.....................................::::::::::--------=======+++++++++++++++++++++++++++++++++++++=========================------------------::::::::::.......·······              
           ······.........::::::::::::::::::::................................:::::::-----=====++++xxxxxx**************************xxxxxxxxx++++++++++++++===================------------::::::::.......·······             
          ·····.......:::::::::::::::::::::::::::.............................:::::----===+++xxx****%%%%&&&&&&#############&&&&&&&%%%%%*******xxxxxxxx++++++++++++++==============----------:::::::......······             
         ····......::::::::-------------:::::::::::..........................::::---===+++xx***%%%&&&####@@@@@@@@@@@@@@@@@@@@@@@@####&&&&&%%%%*******xxxxxxxxx+++++++++++++===========--------::::::......·····             
        ····.....:::::::--------------------:::::::::.......................::::---===++xxx**%%&&&###@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###&&&&%%%%%********xxxxxxxxxxx++++++++++++========------::::::.....······            
        ····.....:::::--------------------------::::::::....................::::---===++xx***%%&&&####@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###&&&&&%%%%%**********xxxxxxxxxxxxx+++++++++=======------:::::.....·····            
        ····....::::::-------=============---------:::::::::................:::::---===+++xx***%%%&&&#####@@@@@@@@@@@@@@@@@@@@@@@@@#####&&&&&%%%%%%*************xxxxxxxxxxxxxx+++++++++======-----:::::....·····            
         ····....:::::-------================---------:::::::::...............:::::----===++++xxx***%%%%&&&&&&#################&&&&&&%%%%%%%*******************xxxxxxxxxxxxxxxxx++++++++======----:::::....·····            
         ·····....:::::--------=================---------::::::::::..............:::::::-----====+++++xxxxxx**************************xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx++++++++=====-----::::....·····            
          ·····.....:::::--------=================----------:::::::::::.................:::::::::-------=============++++++++++++++++++++++++++++++++++++xxxxxxxxxxxxxxxxxxxxxxx++++++++======-----::::....·····            
            ·····.....:::::::----------===========-------------::::::::::::.........................::::::::::::::::::------------------=============+++++++++++++++++++++++++++++++++=======-----::::.....·····            
              ······......:::::::---------------------------------:::::::::::::........................................:::::::::::::::-----------============+++++++++++++++++++++========------:::::.....·····             
                 ······........:::::::::---------------------------:::::::::::::::::...........................................:::::::::::::------------=============================--------::::::.....······              
                    ·········.........:::::::::::::::-------------::::::::::::::::::::::::.......................................::::::::::::::::--------------------------------------::::::::......·······                
                          ··········............::::::::::::::::::::::::::::::::::::::::::::::::::................................::::::::::::::::::::::::::-------------:::::::::::::::.........········                   
                                  ············..................:::::::::::::::::::::::::::::::::::::::::::.........................:::::::::::::::::::::::::::::::::::::................···········                        
                                             ················.............................................................................................................·················                                 
                                                           ······················................................................................···························                                                
                                                                               ·········································································