OpenShift access via terminal (SSH) [Permission denied (publickey,gssapi-keyex,gssapi-with-mic).]

Karl Morrison asked:

I’m currently sitting on Ubuntu and would like remote access to my application on OpenShift. I have done the following to create a ssh-rsa key (I’ve replaced the fingerprint with xx:xx…):

> mkdir ~/.ssh
> chmod 700 ~/.ssh
> ssh-keygen -t rsa                                      
Generating public/private rsa key pair.
Enter file in which to save the key (/home/karl/.ssh/id_rsa): openshiftKey
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in openshiftKey.
Your public key has been saved in openshiftKey.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx karl@karllaptop
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
... the rest of the image

This creates two files(notice they are not in ~/.ssh):

~/openshiftKey
~/openshiftKey.pub

I do not know where these files belong, the examples and tutorials say nothing of moving them.

I open the openshiftKey.pub and copy the code:

enter image description here

I paste it into Openshift:

enter image description here

Click save:

enter image description here

Go back to the application settings page and copy the ssh link:

enter image description here

And on my terminal try and connect:

enter image description here

I am sorry as I am new to ssh in this degree, what am I doing wrong?

My answer:


Here is a problem:

Enter file in which to save the key (/home/karl/.ssh/id_rsa): openshiftKey

You didn’t accept the default, and gave your key a specific filename.

If you had accepted the default, then ssh would simply look in that default location anytime you make a remote connection to anywhere, and try to use that key.

In order to use a key other than the default key, you have to specify it explicitly when using ssh, for instance:

ssh -i $HOME/openshiftKey bad-example.rhcloud.com

But you’ll probably want to put the key into its default location, so that you can use the rhc command line tool to manage your gears. Trying to feed it ssh options is … rather hairy.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.