Fix Permission Denied (publickey,gssapi-keyex,gssapi-with-mic)) : when SSH’ing into an OpenShift App 3

Permission denied errors are most likely to be caused because of an invalid read/write permission of your .ssh directory or the key files.

  • Start fresh by removing all your existing ssh keys by deleting .ssh/ directory in the user’s home directory.
    rm -r ~/.ssh

    Delete the .openshift directory as well.
    rm -r ~/.openshift

    express.conf file in the .openshift directory holds the authorization details such as user logon email, so you don’t have to enter login information every time a rhc command is issued.

  • Generate a new SSH key manually.
    Make sure not to use `sudo` with either `ssh-keygen` or the `rhc setup` commands below, as this may leads to files with invalid access permissions.
    ssh-keygen -t rsa -b 4096 -C "your_email_here"
    ssh-add ~/.ssh/id_rsa
  • Upload the generated public key to OpenShift servers, so they can identify you as an authorized user.
    Open ‘’ in a text editor and copy the content inside. Then in your OpenShift Web Console, go to `settings` > `Add a new key` and paste the content of your public key file there.

Setup your RHC client: rhc setup and try ssh’ing into your app,
rhc ssh or ssh <5294c3225973....ssh-address-of-your-application>
SSH url can be find under the ‘Remote Access’ section on the right pane on applications page of the web console.

Leave a comment

Your email address will not be published. Required fields are marked *

3 thoughts on “Fix Permission Denied (publickey,gssapi-keyex,gssapi-with-mic)) : when SSH’ing into an OpenShift App