Using SFTP for file management on WordPress
READING TIME: MIN
Today we look at SFTP (Secure File Transfer Protocol) and what it is that makes it different from vanilla FTP. We’ll also understand its mechanisms and how we can use it to access files on WordPress.
Understanding SFTP
At the heart of SFTP is FTP, so similarities abound. The difference is in the use of SSH (Secure Shell) – a web protocol that safely encrypts the data that you send over the under-protected tubes of the internet.
The Way SFTP Works
All websites reside on servers, just as yours might. A server, of course, is just a computer that specializing in ‘serving up’ webpages. Users like you and me usually interact with such pages or sites via our browsers (and sometimes apps), and these browsers serve the website to use with the help of the HTTP (Hypertext Transfer Protocol), and increasingly, HTTPS (Hypertext Transfer Protocol Secure). As you see, the S in SFTP also appears in HTTPS – which also uses SSH. So, when we type in a URL in the browser, the server responds with the data we requested – if we are allowed to access it, securely. Public websites won’t generally need a login and can get by with HTTP, and those that require a login should ideally use the HTTPS protocol for you to feel safe typing that password.
This is the basic idea; the difference with using FTP is that you, the WordPress website owner, want to directly access your own server and the files on it – hence ‘File’ Transfer Protocol.
So when you use FTP to connect to the server, you can see the files and directories in that server, and thus, transfer them to and fro from your computer to the server.
For FTP, we need a client – a tool that allows you to connect to these servers remotely with credentials that you receive from the web hosting provider. Examples include FileZilla, CODA, Cyberduck, and CuteFTP.
SFTP performs a similar function but is more secure than FTP. It first creates a connection from your client to the remote server via SSH. The data sent and received over SSH is cryptographically protected, so the connection is way more secure.
What Makes SFTP Different?
FTP has two connections (called channels) simultaneously; one used for commands and another for data. So, while your request for accessing a file might travel through the first channel, the file itself will be delivered to you via the second.
Contrary to this, SFTP uses just one channel, and all data ‘packets’ sent through it are encrypted and secured. What this means is that your data is encoded, and only an authorized recipient can decode it. So just like with FTP, the encoded data can hypothetically be intercepted by ill-intentioned parties, but unlike FTP, it cannot be decoded by the interceptor – in other words, your data is safe – thus, making SFTP an easy choice.
Connecting to SFTP
Some of the clients that are used for FTP can be used for SFTP, though these two protocols are as different as they are similar. Some of the prominent and well-loved clients include:
FileZilla: This comes highly recommended, as it is a tool that does everything you need for SFTP and more.
CODA: Basically a full-featured text editor that also does SFTP.
CyberDuck: it’s free, can handle many protocols and comes with a bunch of nifty features, including its own text editor.
Let’s look at what you need to do:
Step 1 – SFTP Hostname: Pretty much all web hosting providers will give you this, an address that needs to be entered in your SFTP client to initiate the connection.
Step 2 – Credentials: A username and password. On some web hosts, these will be the same as those used on your hosting account, while on others you get separate credentials.
Step 3 – The Client: For this guide, we’ll use FileZilla as an example.
Download FileZilla, install it, open the client, and click Files, then ‘Site Manager’.
Step 4 – Connect: At the bottom left, select ‘New Site’ and enter the SFTP hostname and credentials in their respective fields. This is the only time you need to enter these details; from the next time, FileZilla will connect automatically. Click on ‘Connect’ and wait for FileZilla will do its thing. A secure connection may take some time, but once it’s done, you can securely access the files.
The next time you want to connect, just click the ‘Site Manager’ icon and select your website.
There, you’re all set up with SFTP.
More on The Topic
- PHP 8.4 Is Here: A Comprehensive Overview of the Latest Features
- Advanced Custom Fields in WordPress: Unlocking New Potentials for Enterprises
- The Role of APIs in Enhancing Enterprise WordPress Functionality and Scalability
- Integrating WordPress with Enterprise Databases: Techniques and Benefits
- Building a Scalable WordPress Framework for Growing Enterprises
Tags: file managementsftpssh