How to connect WordPress site with SSH/SFTP?

Website upkeep is done most efficiently through the SSH and SFTP protocols. This Helpy-page instructs you how to set up connection to your website with your login information.

When ordering hosting from Seravo, you will receive your required login, passwords and other information.

WordPress is installed on our server to the following path: /data/wordpress/htdocs/. The user’s home directory is under the path /data/home/. Please note that the /data folder and its subfolders are the only place, where the customer can store his/her data. It is also the only location, which Seravo ensures storage and backup for. System files in other directories are destroyed in connection with updates due to data security reasons.

In our service, WordPress’s folder structure applies the Bedrock project’s folder structure, which facilitates, e.g. using the Composer tool. More information can be found in the developer documentation at seravo.com/docs.

SSH

SSH connection allows you to login to the server via command line interface where you can edit your files and utilize the tools provided by Seravo, such as WP-CLI, Composer and Git.

For more information about SSH-connection, visit documentation for developers.

Linux and MacOS

You can login to your site from your computer's terminal with the command

$ ssh -p 12345 alice@example.seravo.com

After you've correctly inserted your password, you will be greeted by the server's login banner and you may begin to work. We've also created a video tutorial explaining the basics of SSH connection.


You may simplify your login process by editing the SSH configuration file /home/[user]/.ssh/config which you can edit with your desired text editor, for example nano.

$ nano ~/.ssh/config

Add the following rows with your own login information

Host example-website
 HostName example.seravo.fi
 User alice
 Port 12345

With these additions, you may login to your website with the command

$ ssh example-website

You may further simplify your login process by utilizing SSH keys. An SSH key works using public-key encryption principles. You can check if you have existing SSH keys with the command

$ ls -l ~/.ssh

A key pair could be named for example id_rsa id_rsa.pub. You can create a new key pair with the command

$ ssh-keygen

This outputs:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/username/.ssh/id_rsa.
Your public key has been saved in /home/username/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:1TnYgo25Dq3t11It8Gj++iHWJvo9IgXeWaP/GBHXI84 
username@computer
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|         = + . . |
|        + = *....|
|       ..o..=+. .|
|      ..So B.E   |
|       =. B.+..  |
|      . o+++=.   |
|       ..o==++   |
|        o+o*=o.  |
+----[SHA256]-----+

When you have a key pair, you can transfer your public key to the server with the command

$ ssh-copy-id example-website

Now when you login to your website from the command line the process is quick, easy and safe - you can just concentrate on the things that matter.

Windows

On Windows you can connect to your server either using PuTTY client or similar to Linux using Windows CMD or PowerCell terminal.

Using Putty

For a quick and easy login, input your information to the Host Name and Port -fields.


To simplify your login process, you can save your login information as part of information which is sent to the server from the Connection > Data -menu


You can create an SSH key pair with the separate PuTTYgen-application. After you have connected to the server, you can transfer your public key to the server


After creating and transferring your public key to the server, you can set your connection to use your private key from Connection > SSH > Auth

Using Windows CMD / PowerCell

SSH connection can be established on Windows similar to Linux terminal using CMD or PowerCell terminal.
To login just fill the given details
> ssh -p 12345 alice@example.seravo.com

after which you'll be prompted to give your password. 

You can simplify the login process by creating a SSH configuration file at

C:\Users\[your user name]\.ssh\config

If there's no .ssh folder, you can create one. 

At .ssh folder you can simply just create config file using editor. Make sure the file is named just "config" and not for example config.txt or other type. 

Here's example for config file

Host example-website  
  HostName example.seravo.fi  
  User alice  
  Port 12345

After that you can login to your website using 

> ssh example-website

You may further simplify your login process by generating and adding SSH keys. This can be done with the exact same commands as on Linux / MacOS tutorial in this document. 

OBS! On Windows CMD / PowerCell there's no command ssh-copy-id so you need to manually copy your .pub key to your website. This can be done by copying your public key file (.pub file) contains from

C:\Users\[your user name]\.ssh\

to your websites file authorized_keys

/home/[your user name]/.ssh/authorized_keys

After this you should be able to login on your website using SSH without being prompted to give your password. 

You can find more information for generating SSH keys on Seravo.com Docs: Configuring SSH

SFTP

A website is a sum of it's parts and one of them is the content. To add content to your website from your local workstation, you need a connection for file transfer. To transfer files, you can use the following command

$ scp source-directory/file target-address

SCP allows you to quickly transfer files from your workstation to the server and from the server to your workstation. A command could look like the following:

$ scp alice@example.seravo.com:/htdocs/index.php

which would download the index.php to your current working directory. Often it is important to be able to organize your files and folders a bit more freely. Even though SCP is lightning fast, it does offer quite limited options for file management. For these situations there is the SFTP protocol which can be used from the command line as well as with the free FileZilla-application. After installing FileZilla, you can connect to your server by inserting your login information to the fields in the application. FileZilla requires specifying SFTP protocol by prefixing host with sftp://.


After connecting to the server, you can freely manage your directories and files.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us