How do I connect to my WordPress site with SSH/SFTP?

In order to upkeep and maintain websites effectively, the admin must be able to edit the site's content, files and server settings, either by establishing an SSH connection, or via SFTP. In this article, we instruct you how to set up connection to your website with your login information.

After ordering your hosting service from Seravo, you will receive your required login, passwords and other information at the time of delivery of your order. Please save the information for later use!

WordPress is installed on our server at /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 data. It is also the only location in Seravo's service that is backed up routinely. System files in other directories are destroyed in connection with updates due to data security reasons.

In Seravo's service, WordPress’s folder structure follows the Bedrock project’s folder structure, which allows e.g. the use of the Composer tool. Read more about the folder structure on our developer documentation at seravo.com/docs.

SSH

SSH connection allows you to login to the server via command line interface. Here 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 Seravo's documentation for developers.

Linux and MacOS

You can login to your site from your computer's terminal with the following 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 at /home/[user]/.ssh/config which can be edited with your desired text editor. In this example, we're using the nano text editor.

$ nano ~/.ssh/config

After opening the file, edit it and 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 following 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]-----+

After a key pair has been formed, you can transfer your public key to the server with the command

$ ssh-copy-id example-website

From now on, when you login to your site on the command line, the login process is quick easy and safe. Now you can concentrate on the things that really matter!

Windows

On Windows, you can connect to your server either by using the PuTTY client, or by using Windows CMD or PowerCell terminal (similar to the Linux example above).

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 a separate PuTTYgen application. After you have been 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

An SSH connection can be established on Windows by using the Windows command line, CMD, or PowerCell terminal. This method is similar to Linux terminal.
To login, fill the given details, after which you will be prompted to enter your password:
> ssh -p 12345 alice@example.seravo.com
	

SSH configuration

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

C:\Users\<em>[your user name]</em>\.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 simply named "config", and not for example "config.txt" or some other file type. 

Here's an example of the contents of a config file:

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

After creating or editing the file, you can login to your website by using the following command: 

> ssh example-website<br>

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 described earlier on this page.

ATTENTION! When using 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), found at

C:\Users\<em>[your user name]</em>\.ssh\ to your websites file authorized_keys at /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 about generating SSH keys on Seravo.com Docs: Configuring SSH.

SFTP

A website is a sum of its parts, and one of them is the content. To add content to your website from your local workstation, you need a secure connection for file transfer. To transfer files form the command line, 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 example:

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

This would download the index.php to your current working directory.

FileZilla

Often however 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.

Where can I find the .htaccess file?

On several hosting services, server settings can be modified by editing the .htaccess file. Instead of Apache, Seravo uses a faster HTTP-server, called NGINX. You can find more information about NGINX configurations on our website: How do I add custom configurations to the web server?

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