Permission Denied

Hong Hua
2 min readJan 10, 2018

--

Ever encountered the above mentioned error while attempting to ssh into a remote server or cloud instance? Well, I did while in the midst of executing an Ansible Playbook with an OpenShift instance as the intended target host endpoint.

Why use Ansible with an OpenShift xPaaS, you might ask? Why not? There is so many types of IT automation tasks that Ansible can achieve….

Any way back to the theme of this post — security. This exact error shows up both in the terminal window as well as the log file for Ansible

2018–01–08 02:08:06,124 p=761 u=root | fatal: [0.0.0.0]: UNREACHABLE! => {“changed”: false, “msg”: “Failed to connect to the host via ssh: Warning: Permanently added ‘0.0.0.0’ (ECDSA) to the list of known hosts.\r\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n”, “unreachable”: true}

A familiar error, usually due to missing public keys that the ssh client requires to establish connectivity. Problem is, there already exists a public key id_rsa.pub in the ~/.ssh directory of my client workstation, which I created prior to this.

So what did I do wrong?

After some research, it was determined that the public key has to be clearly made known to the ssh client. So I proceeded to create an authorized_keys file containing the public key that I earlier generated. It is located in the same directory as the public key — ~/.ssh The file will be read by any activessh clients on the client workstation.

The result was a successful retry of the execution of the Ansible Playbook. Moments like these, brings to mind the phrase “so close, yet so far”…..

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Hong Hua
Hong Hua

Written by Hong Hua

Servant to the Open Source community

No responses yet

Write a response