SSH

SSH is a protocol for secure remote login and other secure network services over an insecure network. Kinsta provides SSH access with all of our Managed WordPress Hosting plans. SSH access allows you to log into a command prompt, perform common sysadmin tasks, and execute commands just as if you were sitting at the server itself. You can run additional tools such as Git, Composer, WP-CLI, etc. If you’re on an Enterprise plan, you can also use tools like npm. Follow the directions below on how to connect to SSH on your WordPress site.

SSH should be used by advanced users only. Running improper commands via SSH could easily break your site. If you are not comfortable doing this, please check with a developer or our Support team first.

SSH access login info

To connect to SSH, you’ll need the following pieces of information:

  • host/server address (IP address)
  • username (SFTP Username, not your email address)
  • password
  • port (we take security seriously here at Kinsta, each site uses a different port)

You can find this information under the SFTP/SSH section of each site’s Info tab within MyKinsta.

SFTP and SSH details in MyKinsta.
SFTP and SSH details in MyKinsta.

Change the SFTP/SSH password

If you want to update the SFTP/SSH password for the current environment, hover over the password and click Generate new SFTP password.

Generate a new SFTP/SSH password for your WordPress site.
Generate a new SFTP/SSH password for your WordPress site.

To confirm the password change, click Generate new password.

Confirm the password change by clicking Generate new password.
Confirm the password change by clicking Generate new password.

Set a password expiration

If you want the STFP/SSH password to expire and regenerate at regular intervals automatically for the current environment, click the edit icon under Password expiration.

Change the STFP/SSH password expiration time.
Change the STFP/SSH password expiration time.

Choose how often you want the password to expire and regenerate, and click Save changes.

Choose the interval for the password expiration.
Choose the interval for the password expiration.

Authentication methods

To change the SSH authentication methods to enable or disable access with a username and password for the current environment, click the edit icon under Authentication methods.

Change the SSH authentication methods.
Change the SSH authentication methods.

Select Password to enable or disable SSH access with a username and password, and click Save changes. You cannot disable access using an SSH key; however, you can disable all SFTP/SSH access.

Select Password to enable or disable SSH access with a username and password.
Select Password to enable or disable SSH access with a username and password.

IP allowlist

To specify a list of IP addresses that are allowed to access your environment via STFP/SSH, click the edit icon under IP allowlist.

Specify which IP addresses can access the environment via SFTP/SSH.
Specify which IP addresses can access the environment via SFTP/SSH.

Enter the IP addresses you want to allow access via SFTP/SSH and click Add. You can specify multiple addresses separated by a comma, e.g., 1.1.1.1, 2.2.2.2. You can also specify a range of IP addresses using a slash, e.g., 1.1.1.1/32.

Specify the IP addresses that are allowed to access your environment via SFTP/SSH.
Specify the IP addresses that are allowed to access your environment via SFTP/SSH.

Once you have entered all of the required IP addresses, click Update IP allowlist.

Update the IP allowlist for SFTP/SSH.
Update the IP allowlist for SFTP/SSH.

How to connect to SSH with a username and password

The easiest method for connecting via SSH is to use a username and password. To connect with a username and password, you must ensure the password authentication method is enabled. The steps to do that vary depending on your operating system. We’ve outlined the process for each below.

Connect to SSH with a username and password on Windows

Windows users require a terminal client to connect to SSH.

  1. We recommend downloading the free PuTTY client using the .msi installer. This also includes PuTTYgen, which you’ll need if you want to use SSH keys.
  2. Launch PuTTY and enter your Host IP Address and the unique Port number (both found in MyKinsta > Sites > sitename > Info > SFTP/SSH > Host). Then click Open.
    SSH PuTTY client for Windows.
    SSH PuTTY client for Windows.
  3. If this is your first time connecting, you will most likely see a rsa2 key prompt. Go ahead and click Yes, which will trust the host in the future.
    PuTTY security alert about rsa2 key.
    PuTTY security alert about rsa2 key.
  4. In the terminal screen, you’ll need to enter your Kinsta username and press Enter/return.
    Enter your Kinsta username in PuTTY and press Enter/return.
    Enter your Kinsta username in PuTTY and press Enter/return.
  5. You’ll then be prompted to enter your password. Press Enter/return again.
    Enter your SSH password in PuTTY.
    Enter your SSH password in PuTTY.

You’re now connected via SSH to your WordPress site.

SSH login successful with PuTTY.
SSH login successful with PuTTY.

You can run commands such as ls or cd to list items and navigate throughout your site’s directories. WP-CLI is also installed by default on all sites.

Running SSH commands in PuTTY.
Running SSH commands in PuTTY.

Connect to SSH with a username and password on Mac/Linux

On Mac or Linux, it’s a lot easier to connect to SSH because the operating system (OS) already has a terminal built into it.

  1. Open the terminal by going to Applications > Utilities and double-clicking on Terminal.
  2. Then enter the command like this (You can copy/paste this command directly from MyKinsta):
ssh username@hostip -p portnumber
SSH terminal command in MyKinsta.
SSH terminal command in MyKinsta.

How to connect to SSH with SSH keys

Another option for connecting to SSH is to generate an SSH key pair. SSH keys provide a more secure way of logging into a server and eliminate the need for a password. You can also further protect your login by adding a passphrase, but this isn’t required.

How to generate SSH key pair on Windows

  1. Launch PuTTYgen. If you haven’t downloaded it yet, you can grab it here.
  2. The default parameters should be fine in most configurations. Click on Generate.
    Generate a new key in PuTTY Key Generator.
    Generate a new key in PuTTY Key Generator.
  3. Move your mouse around to generate some randomness.
    Moving your mouse around to create randomness in PuTTY Key Generator.
    Moving your mouse around to create randomness in PuTTY Key Generator.
  4. Save both your public (.txt) and private key (.ppk). Important: Keep your private key safe and don’t share it with anyone.
    Save public and private keys from PuTTY Key Generator.
    Save public and private keys from PuTTY Key Generator.
  5. Leave the PuTTY window open and skip down to where you add your public key to MyKinsta.

How to generate SSH key pair on MAC/Linux

Launch the Terminal from Applications > Utilities > Terminal and use the following command to start the key generation:

ssh-keygen -t rsa

Choose a location to save your private key. If you leave it blank, it will save it here:

/home/youruser/.ssh/id_rsa

The public key (.PUB) will get created in the same location.

/home/youruser/.ssh/id_rsa.pub

You will then be prompted to choose a passphrase. You can leave it empty if you don’t want to use a passphrase.

How to add SSH keys in MyKinsta

Now that you have your SSH keys, you can upload your public key to MyKinsta.

  1. Click into your user profile in the top-right corner, and click on User Settings.
    MyKinsta user settings.
    MyKinsta user settings.
  2. In the My Account tab, click on the Add SSH key button.
    Add SSH key in MyKinsta.
    Add SSH key in MyKinsta.
  3. Choose a label and paste your publickey.
    • If you’re running Windows, copy and paste the public key directly from PuTTYgen.
    • If you’re running Mac/Linux, you can copy your public key to your clipboard by using the following command in Terminal:
pbcopy < ~/.ssh/id_rsa.pub
  1. After you paste your public key, click the Add SSH key button.
    A valid rsa key in MyKinsta.
    A valid rsa key in MyKinsta.

How to connect to SSH on Windows with SSH keys

  1. Launch PuTTY and enter your Host IP Address and the unique Port number (both found in MyKinsta > Sites > sitename > Info > SFTP/SSH > Host).
    Host Name and Port number in PuTTY client.
    Host IP and Port number in PuTTY client.
  2. Under Connection > Data enter your Kinsta username in the Auto-login username field.
    SSH Auto-login username in PuTTY.
    SSH Auto-login username in PuTTY.
  3. Under Connection > SSH > Auth > Credentials, click the Browse button and select your private key file for authentication.
    Add your SSH private key file in PuTTY.
    Add your SSH private key file in PuTTY.
  4. Under Session, enter a new Saved Sessions name and click on Save. Click the Open button to start a new session.
    Name and save your SSH session in PuTTY.
    Name and save your SSH session in PuTTY.
  5. You’ll most likely see a security alert about a change in keys. Click on Yes.
    Click Yes in the PuTTY security alert about a change in keys.
    Click Yes in the PuTTY security alert about a change in keys.
  6. If you set up a passphrase, you’ll need to enter that.
    Enter passphrase for key, if applicable.
    Enter passphrase for key, if applicable.

    Otherwise, you’ll be logged right in.

    Logged into the site with an SSH key.
    Logged into the site with an SSH key.

How to connect to SSH on MAC/Linux with SSH keys

  1. Launch the Terminal from Applications > Utilities > Terminal.
  2. You now need to load your saved private key using the following command:
ssh-add ~/.ssh/id_rsa
  1. If you set a passphrase for your key, you’ll be prompted to enter that.
  2. Enter the command in the following form (You can copy/paste this directly from MyKinsta):
ssh username@hostip -p portnumber
SSH terminal command in MyKinsta.
SSH terminal command in MyKinsta.

Disable/enable SFTP/SSH access

If you want to disable SFTP/SSH access so no users can connect via STFP/SSH, on your site’s Info tab, click Disable.

Disable SFTP/SSH access.
Disable SFTP/SSH access.

To confirm the changes, click Disable SFTP/SSH access.

Confirm the changes to disable SFTP/SSH access.
Confirm the changes to disable SFTP/SSH access.

When SFTP/SSH access is disabled, the connection details are no longer shown.

SFTP/SSH access disabled.
SFTP/SSH access disabled.

If you want to enable access and show the connection details, click Enable > Enable SFTP/SSH access.

Additional notes

If you have trouble connecting, you might need to change the password or delete entries from your known_hosts file.

Was this article helpful?