SSH into your container

Do not use SSH to install software required for production. Servers should be able to go down at any time and be started at any time wi th no human intervention. If you need custom software installation, please refer to this guide. SSH is provided in the rare case you need to go on an actual production container to debug and check when something cannot be reproduced or has gone horribly wrong.

Creating a keypair

First of all you should have a key pair specific to you on your computer. In order to check if you have one, simply type ls ~/.ssh in your console.

ore-no-pc:test david$ ls ~/.ssh/
id_rsa		id_rsa.pub

As above, if you do not see id_rsa and id_rsa.pub, then you need to create one by using the ssh-keygencommand:

ore-no-pc:test david$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/david/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in meow.
Your public key has been saved in meow.pub.
The key fingerprint is:
8d:b9:76:d5:24:b9:26:80:08:f0:e0:03:fc:1c:84:6e david@ore-no-pc.local
The key's randomart image is:
+--[ RSA 2048]----+
|=.+.             |
|                 |
|.o+ o            |
|                 |
|.                |
|         . +     |
|        o .      |
|       . .       |
|                 |
+-----------------+

Now you can simply run ls ~/.ssh/ again to check that you have a key pair.

Uploading your public key

In order to SSH into a machine you ONLY have to provide it with your Public Key or id_rsa.pub. This will allow the machine to identify you. NEVER transmit your Private Key id_rsa over the network.

Open your Dashboard and click on the Settings button on the top right, then click on SSH Keys tab.

Then, lick on the Add new public key button to add a new user key.

You will need to display your public key by typing cat ~/.ssh/id_rsa.pub

ore-no-pc:test david$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc... david@ore-no-pc.local

Simply copy the public key body (starting with ssh-rsa), and paste it in the Public Key field. Also don't forget to fill the Key Name field with a username that you would like to use to log in with. Please note that Key Name field allows only letters, numbers and underscores with no white spaces.

Once you are done, you should see a list of your public keys that stored to your account.

Attach the public key to your application stack

Then, let's head to application settings page and attach the public key to your servers.

Scroll the page down, and click on Choose Key Pairs button.

You will see the list of public keys you stored at your account, simple click Attach button to add the key to your servers (the current application servers only).

Head to the Logs tab and watch the moDaemon logs of your server until you see something like:

[08/Jun/2015:19:25:37 +0900] Switching port forward from blue to green container
[08/Jun/2015:19:25:37 +0900] Adding user: My_office_Laptop

That will indicate your user has been added to the container.

SSH into your container

First, you need to decide which container you want to SSH into. You can find the IP addresses of each server on the stack details page.

You can log into the container by specifying the SSH user name (using the key name of the key pair registered in the application stack) and the IP address of the server. Executing the SSH command as follows:

$ ssh My_office_Laptop@52.68.3.179

Check your SSH history

It is possible to see who has entered your server by viewing the auth logs. Simply go to the stack Logs page, select ssh, and you should see the authentication logs for the machine.

Last updated