FTP / SFTP Guide for Beginners

File Transfer Protocol (FTP) or Secure File Transfer Protocol (SFTP)

The skill of moving files to and from your web hosting server is a fundamental one for aspiring website owners. In the beginning, many of you may rely on the File Manager in your control panel. While this is convenient, File Transfer Protocol (FTP) or Secure File Transfer Protocol (SFTP) offers more options.

I will break this article into two parts. Let's go through them in more detail:

What is a File Transfer Protocol (FTP)?

FTP is a standard network protocol used to exchange files between computers on a private network or Internet. It's been around since 1971, making it one of the first protocols developed for this purpose. Impressively, it has withstood the test of time.

What is a Secure File Transfer Protocol (SFTP)?

SFTP is a more secure version of FTP. It uses Secure Shell (SSH) encryption to help protect your login credentials and your transfer data. It is almost identical to FTP. However, SFTP uses a different protocol, so you can't use a standard FTP client to talk to an sFTP server. You also can't connect to an FTP server with a client that supports only SFTP.

How FTP and SFTP Work?

Both FTP and SFTP are client-server protocols and they rely on communication channels between the client and the server.

FTP for Dummies – How FTP Works?

FTP can operate in the active and passive modes.
FTP can operate in active and passive modes. (Source)

FTP works on a client-server architecture and uses separate control and data connections. FTP users may authenticate themselves with a clear-text sign-in protocol (generally a username and password). However, some servers do allow anonymous connections.

FTP can operate in the active (the default) and passive modes. In the active mode, the FTP client connects from its port 20 to the server's port 21. In passive mode, both ports are open for communication. Your network firewall needs proper configuration so that both active and passive modes will function properly.

SFTP for Dummies – How SFTP Works?

How SFTP Works?
How SFTP works (Source)

SFTP is separate and usually packaged with SSH that similarly works over a secure connection. The critical difference is that SFTP adds encryption to both credentials and the data itself. SFTP is not to be confused with FTPS, which is FTP run over SSL, a security layer different from SSH.

FTP vs SFTP: What's the Difference?

The key difference between FTP vs SFTP is that SFTP uses a secure channel to transfer files while FTP doesn’t.

How to Use FTP / SFTP for Your Website?

While you can run FTP and SFTP from a command-line interface, using an FTP Client application is much more convenient. There are many suitable FTP applications around. My preferred choice is Filezilla, available since 2001, is free, and works on most platforms.

1. Using the Filezilla FTP Application

Filezilla offers a familiar interface for Windows users.
Filezilla offers a familiar interface for Windows users.

Head to the Filezilla website and download the version you need. There are separate installers for different platforms. Once downloaded, you can launch the installation file and follow the instructions. Be aware that it will try to get you to install some bloatware – but you can decline the offer.

Next, launch the application.

For most connections, you'll need to enter three pieces of information:

  1. Host,
  2. Username, and
  3. Password.

Your web host usually provides these. If you have a web hosting account, your web host will give these settings to you in an email or online via the web hosting control panel. 

Connect to a Server

You may need to create a new FTP user if this is the first time using FTP with your account. If you're connecting to a server that isn't under your control, you'll need to contact the server administrator.

If you have an SFTP connection instead of an FTP connection, Fill out your Host and Username as described above. Enter either your Password (if applicable) or “none” for the Password. Next, hit the “Connect” button. 

The main display area is split into two parts. One the left is your local machine, and on the right is the remote server. The display panels are almost identical to the Windows file manager. Drag and drop anything you want to move to or from your web server.

2. FTP by Command Line

Even if you don't wish to use a dedicated FTP application like Filezilla, you'll need a medium to connect to your server.

Windows

For example, in Windows, you can use the FTP instruction from the command line by typing:

ftp <hostname / IP address>

Mac

On a Mac, you can use the built-in FTP application.

  1. Click on your Finder icon,
  2. Select “Go,” then “Connect to Server.”
  3. Enter the server address and
  4. Click “Connect.”

Regardless of the method chosen, you will need to enter your username and password to complete the connection.

Cyberduck

If you aren't happy with the default Mac FTP application, there are others you can download and install. I recommend Forklift or CyberDuck.

Basic Commands

After the connection, though, things get more complicated. As with all command-line interfaces, a good memory is a must. Here are some basic commands to start off with:

Uploading files – ftp> put filename
Display current directory – pwd
Changing directory – cd <directory name>
List directory content – ls
Download all HTML files – mget *.html
End connection – close
Reconnnect to a server – open ftp.<servername / IP address>

Final Thoughts – FTP / SFTP Explained

Basic FTP commands can be helpful if you're creating scripts that update your website or need to transfer large groups of files. However, unless you're opposed to installing new applications, I highly recommend using an FTP application over command instructions.

Read more:

Photo of author

Article by Jerry Low