How to upload to wordpress securely using FTP

WordPress guide Fri 20 July, 2018

FTP (File Transfer Protocol) is a popular method for transferring files between two remote systems.

FTP allows you to upload files from your computer to your WordPress site. To do this you will need an FTP client, which is a desktop app that connects your computer to your WordPress hosting account.

Using FTP to Upload WordPress Files (Mac & Windows)

First, you will need to download and install an FTP client on your computer. FTP client is an app that helps you connect to your website and transfer files using the FTP protocol.

Here are some of the most popular FTP clients:

FileZilla (Windows, Mac, Linux | Free)
WinSCP (Windows | Free)
Cyberduck (Mac | Free)

For this guide, I will be using FileZilla. You can use any other FTP client you prefer though. The basic concepts are the same no matter which software you use.

Why do you need FTP?

An FTP allows you to manually upload files in WordPress that sometimes won’t work due to an error on your site.

Normally, you won’t need FTP to upload files at all. You can easily upload images from WordPress admin area. But this does come in useful, you can install plugins to your site using FTP to avoid the steps in wordpress. (Remember to activate the plugin after installing.)

Connecting To Your WordPress Site Using FTP

When you open your FTP software, it will ask you to connect to your website using your FTP login credentials. 

Your FTP login credentials are usually sent to you by email when you sign up for your hosting account. You can also find your FTP account information in your hosting account’s cPanel dashboard.

If you use Managed wordpress on Godaddy, for example, you can find your user credentials under Hosting > Site > Settings > SFTP User

Your details should look something like this (but all different, of course).

Host server: www.lunardigital.co.uk Username: superadmin Password: chocolatecake Port: 22

Enter your details and press the quick connect button to get started

For users who will connect regularly you can use the Site Manager in Filezilla to save your login settings for future use. Go to File > Site Manager > New site.

If it’s the first time you’re connecting to this website from your computer then you may be asked whether you trust the connection.

If you do see this, just check the box next to ‘Always trust certificate for future sessions’ and click on the OK button to continue.

FileZilla will attempt to login to your website using the credentials you entered. Once connected, you will see the list of files and folders on your website under the ‘Remote site’ column.

Navigating your site files

The remote site column displays files and folders on your website and the ‘Local site’ section shows files on your computer.

You can browse Local site to locate the files on your computer that you want to upload to your website. Next, you need to right click the file and select upload from the menu.

Uploading files is now super easy, on OS X you can drag and drop files directly onto your hosting from a Finder window. In this image I’ve done exactly that with a plugin file.

File upload in progress.

The only thing to bare in mind here is that WordPress needs certain files and folders in specific locations to work properly. This means you cannot just upload a file anywhere. So we just need to know where upload files in file system.

If you want to manually upload a plugin to your website. You would first download the plugin and unzip the file and add folder to

Navigate to /wp-content/plugins/ folder – (this can be directly copied and pasted into the remote site line if you have issues finding)

After that you will need to unzip the plugin file. Inside the zip file, you will find the plugin folder. WordPress looks for plugins in the /wp-content/plugins/ folder.

Use FTP to back up a website

You can also use FTP to backup all WordPress files. Simply select all files and folders, right click and download them to your computer.

Remember: This is just the backup of your WordPress files. it doesn’t include your content (Database).

If you want to backup content as well, then you can do so by creating a manual backup of your WordPress database.

Connect using the command line instead

We can use the Windows Command Prompt or Mac OS X Built-in Terminal to connect to a website using SFTP. Users may need to install OpenSSH if it’s not pre-installed on your system. 

SFTP, which stands for SSH File Transfer Protocol, or Secure File Transfer Protocol. It is a separate protocol packaged with SSH that works in a similar way over a secure connection.

In most cases, SFTP is preferable to FTP because of its security features and ability to piggy-back on an SSH connection. FTP is an insecure protocol that should only be used in limited cases or on networks you trust.

How to connect using SFTP in Terminal

The snippets below should work in the command prompt on any OS provided you have an SSH command and the relevant login details.

SFTP uses the SSH protocol to authenticate and establish a secure connection. Because of this, the same authentication methods are available that are present in SSH.

If you can connect to the host or server using SSH, then you have all the requirements necessary to use SFTP to manage files. Test SSH access with the following command:

ssh user@your_server_ip

If that works, exit out by typing

exit

We can establish an SSH connection and then open up an SFTP session using that connection by issuing the following command:

sftp user@your_server_ip

You will connect the the remote system and your prompt will change to an SFTP prompt.

If you are working on a custom SSH port (not the default port 22), then you can open an SFTP session as follows:

sftp -oPort=custom_port user@your_server_ip


Useful SFTP Commands in terminal

Command Description
sftp Establishes an sftp connection to a remote system.
bye Quits the SFTP session
help Lists all SFTP commands
ls Lists the contents of the remote working directory.
lls Lists the contents of the local working directory.
cd Changes the remote working directory.
lcd Changes the remote working directory.
mkdir Creates a directory on the remote system.
rmdir Deletes a directory on the remote system.
get Copies a file from the remote working directory to the local working directory.
put Copies a file from the local working directory to the remote working directory.
delete Deletes a file from the remote working directory.

Continue reading…

Useful Terminal Commands for OS X

The Terminal is a powerful command line interface on Mac OS X. Terminal can perform simple tasks like navigating and editing files, but can also be used to monitor your network or computer, access a remote server and configure hidden settings.

read more