SSH Keys

SSH Keys

When you create an instance using cloud provider image, you do not know the password for the users, so you can not login. The remedy is to login with ssh keys. You have to modify your Security Groups(Firewall) settings to accept SSH connection from your network. You can create ssh keys as shown below:

$ ssh-keygen -t rsa -f test-key.key
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in test-key.key.
Your public key has been saved in test-key.key.pub.
The key fingerprint is:
0f:9d:f8:e2:ac:1a:92:8d:7b:d4:66:10:82:e2:c8:f9 arindam@arindamchoudhury
The key's randomart image is:
+--[ RSA 2048]----+
| .               |
|o . .            |
|= .. .           |
|.+  .    o .     |
|  .  o  S o      |
|   E. +  +       |
|  +.oo  . o      |
|   o.. o .       |
|  ......o        |
+-----------------+

$ ls
test-key.key  test-key.key.pub

It will generate a public (test-key.key.pub) and private (test-key.key) key pair. You upload your public key to your cloud provider. While instantiating a server you have to select the security keys, and then you can access the cloud server with ssh using the private key:

$ ssh -i test-key.key user@ip-of-your-server

The access permission for the private key should be 0X00 where X can be 4, 6 0r 7, else you will get the following error and asked for login password:

$ ssh -i test-key.key user@ip-of-your-server
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0740 for 'test-key.key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: test-key.key
user@hostname's password: 

ECmanaged provides easy management of your ssh keys. When you integrate a cloud provider, your ssh keys get automatically imported to ECmanaged. So, you can continue to use your old keys without any trouble.

You can also create new keys using New SSH Key wizard. You can access the wizard by clicking Add New Key button from Preferences > SSH keys . The keys generated with ECmanaged can be used with multiple provider.

In the New SSH Key wizard, as shown in picture above, you can do three things:

  • New Key: by selecting the New Key option, you can generate a new key pair. In the next window, you will be prompted to download your private key. You must keep your private key safe.
  • Import Private Key: You can upload your private key from your local filesystem.
  • Import Private Key: You can upload your public key from your local filesystem.

When you create key pair using ECmanaged, they got saved by default. You can remove the private key from the options menu, as shown below:

You can access this from Preferences > SSH keys, then selecting your key and clicking on the Options button.