Connect to a site via SSH

You can connect to your site using SSH in order to run commands, using any standard SSH tool

Before you start : setting up your SSH keypair

If you haven't already, setup an SSH keypair

Finding SSH connection details

  1. Click on the site you want to connect to : on the settings tab ensure you have an SSH key.  If you don't currently have one see Setting up an SSH key
  2. Go to the Connect tab
  3. SSH connection details are in the section Connect to SSH to run shell commands.
    1. If you are on a Mac, a linux machine, or you use a linux VM (eg Vagrant or Virtualbox) then pasting the openssh commandline into a terminal should be sufficient
    2. On Windows:
      1. Windows 10 now includes OpenSSH - see here for docs on enabling it
      2. You can use Cygwin, or Git Bash, Windows subsystem for linux or a virtual machine and run openssh - in which case you can also paste the openssh commandline
      3. Alternatively if you prefer a more GUI approach use Putty or Kitty:
        1. Download and install PuTTY from the PuTTY download page. Be sure to install the entire suite.
        2. If you haven't already, ensure your private key is in the correct format for Putty: it uses a different format from OpenSSH .  Putty provides the PuttyGen tool which can convert OpenSSH keys to Putty compatible ones
        3. In the Host Name (or IP address) field, paste the User and  Host from idealstack in the format user@host (eg wordpress@54.79.82.255) and paste the Port in the Port field
        4. Under Connection > Auth > SSH in the config tree on the left, select your SSH key
        5. Click open, after a message about caching the host key (accept it), you'll be logged into your site

 

Troubleshooting

Make sure you've setup an SSH key

If you see this message, you still need to upload an SSH key.  See  Setting up an SSH key

 If you get "Permission denied (publickey)." when you try to connect

This means that there's a problem with your key - most likely it does not match the one you set in idealstack.  Try specifying the private key file on the commandline using the '-i' option.  You can also specify the '-v' option to see more verbose output

2019-09-16 12_12_45-Window.png

Check that the fingerprint of the private key matches what is shown in idealstack.  You can do that with this command (change the key filename appropriately)

ssh-keygen -l -E md5 -f ~/.ssh/id_rsa

2019-09-16 12_15_32-Window.png

The md5 string of hexadecimal numbers should match what is shown in the ssh key list in idealstack: if it doesn't, upload the correct public key file

2019-09-16 12_16_36-Window.png

Load key "/home/youruser/.ssh/id_not_a_real_key": invalid format

If you get an 'invalid format' error, the private key file is not really an ssh key.  It might be in a different format (eg the 'ppk' format used by PuTTY or WinSCP - if so you can convert it with puttygen)

Use SSH agent forwarding to connect to other ssh connections from your site

It can be very useful to be able to ssh to other machines from within your sites container without a password - for example interacting with github to deploy your code.  The way to do this is to use SSH agent forwarding.  There's some good docs on the github site about how to configure that.