How to Connect to Your WordPress Instance with FileZilla and WinSCP Using SSH Tunnels

April 27, 2024

Connecting to WordPress with FileZilla via SSH Tunnel

When managing WordPress files, security is paramount, especially when accessing them over the internet. A common approach is to use a bastion host as a gateway, which sits in a public network and acts as the entry point to your private network where the WordPress instance resides. By connecting through a bastion host, you create an additional layer of security.

To securely manage your WordPress files using Filezilla or WinSCP, you can create an SSH tunnel that forwards a local port through the bastion host directly to your WordPress instance. Follow the steps below to set up this secure connection:

1.0 Set Up the Tunnel

Open a terminal window and navigate to the directory containing your key.pem file. Then, establish the SSH tunnel with the following command:

ssh -i "key.pem" -L 9999:private_ipv4_address_of_the_wordpress_instance:22 ubuntu@public_ipv4_DNS_of_bastion_host -N

Here's an example using specific IP addresses and DNS:

ssh -i "key.pem" -L 9999:10.0.0.101:22 [email protected] -N

CMD Tunnel CMD Tunnel.

Keep this terminal open to maintain the tunnel.

1.1 Configure FileZilla

With the tunnel running, launch FileZilla and set up a new connection:

Setting Value
Host localhost
Port 9999
User ubuntu
Key File Browse to and select your key.ppk or key.pem file.

FileZilla FileZilla settings 1.

FileZilla FileZilla settings 2.

  1. Connecting to WordPress with WinSCP Using Integrated Tunnel

    WinSCP can also be configured to use an SSH tunnel directly from the application:

    Create a New Connection

    Setting Value
    Host name Enter the private IPv4 address of your WordPress server.
    Port number 22
    User name ubuntu
    Authentication Select your key.ppk key file for the SSH private key.

    WinSCP Connection 1 WinSCP Connection 1.

    WinSCP Connection 2 WinSCP Connection 2.

    Set Up the Tunnel

    Setting Value
    Tunnel Host name Enter the public IPv4 DNS of your Bastion host.
    Port number 22
    User name ubuntu
    Authentication Select the key.ppk file for the SSH private key once more.

    WinSCP Tunnel WinSCP Tunnel.


Profile picture

Written by Justin who tries to build many nice things high up in the clouds, and most of the time fails. He defaults to taking over the world, one vpc at a time. You should follow them on Twitter