SSH into your Box

Unless your project is utilising Always On Boxes you will need to open your Codio Project in order for the Box to be started and ready to receive incoming SSH connections.

Generating Key Pairs

There are several sites that explain generating SSH keys.

Find your local machine’s SSH public Key

This is pretty easy to do. On a Mac or Linux box you can get your public key in one of two ways

  • either copy your local machine’s public key to the clipboard from your local machine’s terminal using pbcopy < ~/.ssh/
  • or on your local machine, open the file ~/.ssh/ and copy it to the clipboard. Be careful with some editors that include control characters that you don’t want to be copied across.

On a Windows machine you’ll probably be using putty, so grab your key from there.

Uploading your Public Key to your Codio Box

You need to upload the public key you just found in the above steps. Once you have it copied to the clipboard, open a terminal tab in your Codio project and enter this key into the .ssh/authorized_keys file. The easiest way to do this is to enter nano .ssh/authorized_keys which will open this file in the nano editor and you can paste it in.

You can view/check to see all/any Public key(s) you have uploaded into your project by opening the terminal and running cat ~/.ssh/authorized_keys.

Enabling and Connecting to your Box from your local machine’s Terminal

  1. Go to Project>Settings and to the Forwarding Settings tab and click the ‘Enable SSH Forwarding’ button
  2. The connection string you need to use is shown there

You will see connection details like this
SSH Forwarding: ssh

You can now connect to your Box from any Terminal window using (in the above example)
ssh -p 29119

If you get a message Permission denied (publickey) then you have not uploaded your SSH Public Key correctly.

You cannot connect to a Codio Box without using a Public Key.