<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
<li>Feature Idea</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<p dir="auto"><code class="notranslate">modules/core/system/setup.py</code></p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.2.1.0
  config file = /home/k0ste/.ansible.cfg
  configured module search path = ['/home/k0ste/ansible/my_modules/']"><pre class="notranslate"><code class="notranslate">ansible 2.2.1.0
  config file = /home/k0ste/.ansible.cfg
  configured module search path = ['/home/k0ste/ansible/my_modules/']
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">GNU/Linux</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">If private ssh key chmod is 644, we have error "SSH Error: data could not be sent to the remote host.", if such error was received by non expert, he will not be able to correct it.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>


<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[k0ste@WorkStation ansible]$ chmod 644 id_rsa

[k0ste@WorkStation ansible]$ ansible -m setup gate.opentech.local --private-key=id_rsa -vvvvv"><pre class="notranslate">[k0ste@WorkStation ansible]$ chmod 644 id_rsa

[k0ste@WorkStation ansible]$ ansible -m setup gate.opentech.local --private-key=id_rsa -vvvvv</pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">Print to stderr about "private_key_file is group/world readable".</p>
<h5 dir="auto">ACTUAL RESULTS</h5>


<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Using /home/k0ste/.ansible.cfg as config file
Loading callback plugin minimal of type stdout, v2.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc
Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/system/setup.py
&lt;gate.opentech.local&gt; ESTABLISH SSH CONNECTION FOR USER: k0ste
&lt;gate.opentech.local&gt; SSH: ansible.cfg set ssh_args: (-o)(ControlMaster=auto)(-o)(ControlPersist=60s)
&lt;gate.opentech.local&gt; SSH: ANSIBLE_HOST_KEY_CHECKING/host_key_checking disabled: (-o)(StrictHostKeyChecking=no)
&lt;gate.opentech.local&gt; SSH: ANSIBLE_REMOTE_PORT/remote_port/ansible_port set: (-o)(Port=22)
&lt;gate.opentech.local&gt; SSH: ANSIBLE_PRIVATE_KEY_FILE/private_key_file/ansible_ssh_private_key_file set: (-o)(IdentityFile=&quot;id_rsa&quot;)
&lt;gate.opentech.local&gt; SSH: ansible_password/ansible_ssh_pass not set: (-o)(KbdInteractiveAuthentication=no)(-o)(PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey)(-o)(PasswordAuthentication=no)
&lt;gate.opentech.local&gt; SSH: ANSIBLE_REMOTE_USER/remote_user/ansible_user/user/-u set: (-o)(User=k0ste)
&lt;gate.opentech.local&gt; SSH: ANSIBLE_TIMEOUT/timeout set: (-o)(ConnectTimeout=10)
&lt;gate.opentech.local&gt; SSH: PlayContext set ssh_common_args: ()
&lt;gate.opentech.local&gt; SSH: PlayContext set ssh_extra_args: ()
&lt;gate.opentech.local&gt; SSH: found only ControlPersist; added ControlPath: (-o)(ControlPath=/tmp/ansible-ssh-%h-%p-%r)
&lt;gate.opentech.local&gt; SSH: EXEC ssh -vvv -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=22 -o 'IdentityFile=&quot;id_rsa&quot;' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=k0ste -o ConnectTimeout=10 -o ControlPath=/tmp/ansible-ssh-%h-%p-%r gate.opentech.local '/bin/sh -c '&quot;'&quot;'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python &amp;&amp; sleep 0'&quot;'&quot;''
gate.opentech.local | UNREACHABLE! =&gt; {
    &quot;changed&quot;: false, 
    &quot;msg&quot;: &quot;SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh&quot;, 
    &quot;unreachable&quot;: true
}"><pre class="notranslate"><span class="pl-v">Using</span> <span class="pl-c1">/</span><span class="pl-s1">home</span><span class="pl-c1">/</span><span class="pl-s1">k0ste</span><span class="pl-c1">/</span>.<span class="pl-s1">ansible</span>.<span class="pl-s1">cfg</span> <span class="pl-k">as</span> <span class="pl-s1">config</span> <span class="pl-s1">file</span>
<span class="pl-v">Loading</span> <span class="pl-s1">callback</span> <span class="pl-s1">plugin</span> <span class="pl-s1">minimal</span> <span class="pl-s1">of</span> <span class="pl-s1">type</span> <span class="pl-s1">stdout</span>, <span class="pl-s1">v2</span>.<span class="pl-c1">0</span> <span class="pl-k">from</span> <span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">ansible</span><span class="pl-c1">/</span><span class="pl-s1">plugins</span><span class="pl-c1">/</span><span class="pl-s1">callback</span><span class="pl-c1">/</span><span class="pl-s1">__init__</span>.<span class="pl-s1">pyc</span>
<span class="pl-v">Using</span> <span class="pl-s1">module</span> <span class="pl-s1">file</span> <span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">ansible</span><span class="pl-c1">/</span><span class="pl-s1">modules</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">system</span><span class="pl-c1">/</span><span class="pl-s1">setup</span>.<span class="pl-s1">py</span>
<span class="pl-c1">&lt;</span><span class="pl-s1">gate</span>.<span class="pl-s1">opentech</span>.<span class="pl-s1">local</span><span class="pl-c1">&gt;</span> <span class="pl-v">ESTABLISH</span> <span class="pl-v">SSH</span> <span class="pl-v">CONNECTION</span> <span class="pl-v">FOR</span> <span class="pl-v">USER</span>: <span class="pl-s1">k0ste</span>
<span class="pl-c1">&lt;</span><span class="pl-s1">gate</span>.<span class="pl-s1">opentech</span>.<span class="pl-s1">local</span><span class="pl-c1">&gt;</span> <span class="pl-v">SSH</span>: <span class="pl-s1">ansible</span>.<span class="pl-s1">cfg</span> <span class="pl-s1">set</span> <span class="pl-en">ssh_args</span>: (<span class="pl-c1">-</span><span class="pl-s1">o</span>)(<span class="pl-v">ControlMaster</span><span class="pl-c1">=</span><span class="pl-s1">auto</span>)(<span class="pl-c1">-</span><span class="pl-s1">o</span>)(<span class="pl-v">ControlPersist</span><span class="pl-c1">=</span><span class="pl-c1">60</span><span class="pl-s1">s</span>)
<span class="pl-c1">&lt;</span><span class="pl-s1">gate</span>.<span class="pl-s1">opentech</span>.<span class="pl-s1">local</span><span class="pl-c1">&gt;</span> <span class="pl-v">SSH</span>: <span class="pl-v">ANSIBLE_HOST_KEY_CHECKING</span><span class="pl-c1">/</span><span class="pl-s1">host_key_checking</span> <span class="pl-s1">disabled</span>: (<span class="pl-c1">-</span><span class="pl-s1">o</span>)(<span class="pl-v">StrictHostKeyChecking</span><span class="pl-c1">=</span><span class="pl-s1">no</span>)
<span class="pl-c1">&lt;</span><span class="pl-s1">gate</span>.<span class="pl-s1">opentech</span>.<span class="pl-s1">local</span><span class="pl-c1">&gt;</span> <span class="pl-v">SSH</span>: <span class="pl-v">ANSIBLE_REMOTE_PORT</span><span class="pl-c1">/</span><span class="pl-s1">remote_port</span><span class="pl-c1">/</span><span class="pl-s1">ansible_port</span> <span class="pl-s1">set</span>: (<span class="pl-c1">-</span><span class="pl-s1">o</span>)(<span class="pl-v">Port</span><span class="pl-c1">=</span><span class="pl-c1">22</span>)
<span class="pl-c1">&lt;</span><span class="pl-s1">gate</span>.<span class="pl-s1">opentech</span>.<span class="pl-s1">local</span><span class="pl-c1">&gt;</span> <span class="pl-v">SSH</span>: <span class="pl-v">ANSIBLE_PRIVATE_KEY_FILE</span><span class="pl-c1">/</span><span class="pl-s1">private_key_file</span><span class="pl-c1">/</span><span class="pl-s1">ansible_ssh_private_key_file</span> <span class="pl-s1">set</span>: (<span class="pl-c1">-</span><span class="pl-s1">o</span>)(<span class="pl-v">IdentityFile</span><span class="pl-c1">=</span><span class="pl-s">"id_rsa"</span>)
<span class="pl-c1">&lt;</span><span class="pl-s1">gate</span>.<span class="pl-s1">opentech</span>.<span class="pl-s1">local</span><span class="pl-c1">&gt;</span> <span class="pl-v">SSH</span>: <span class="pl-s1">ansible_password</span><span class="pl-c1">/</span><span class="pl-s1">ansible_ssh_pass</span> <span class="pl-c1">not</span> <span class="pl-s1">set</span>: (<span class="pl-c1">-</span><span class="pl-s1">o</span>)(<span class="pl-v">KbdInteractiveAuthentication</span><span class="pl-c1">=</span><span class="pl-s1">no</span>)(<span class="pl-c1">-</span><span class="pl-s1">o</span>)(<span class="pl-v">PreferredAuthentications</span><span class="pl-c1">=</span><span class="pl-s1">gssapi</span><span class="pl-c1">-</span><span class="pl-s1">with</span><span class="pl-c1">-</span><span class="pl-s1">mic</span>,<span class="pl-s1">gssapi</span><span class="pl-c1">-</span><span class="pl-s1">keyex</span>,<span class="pl-s1">hostbased</span>,<span class="pl-s1">publickey</span>)(<span class="pl-c1">-</span><span class="pl-s1">o</span>)(<span class="pl-v">PasswordAuthentication</span><span class="pl-c1">=</span><span class="pl-s1">no</span>)
<span class="pl-c1">&lt;</span><span class="pl-s1">gate</span>.<span class="pl-s1">opentech</span>.<span class="pl-s1">local</span><span class="pl-c1">&gt;</span> <span class="pl-v">SSH</span>: <span class="pl-v">ANSIBLE_REMOTE_USER</span><span class="pl-c1">/</span><span class="pl-s1">remote_user</span><span class="pl-c1">/</span><span class="pl-s1">ansible_user</span><span class="pl-c1">/</span><span class="pl-s1">user</span><span class="pl-c1">/</span><span class="pl-c1">-</span><span class="pl-s1">u</span> <span class="pl-s1">set</span>: (<span class="pl-c1">-</span><span class="pl-s1">o</span>)(<span class="pl-v">User</span><span class="pl-c1">=</span><span class="pl-s1">k0ste</span>)
<span class="pl-c1">&lt;</span><span class="pl-s1">gate</span>.<span class="pl-s1">opentech</span>.<span class="pl-s1">local</span><span class="pl-c1">&gt;</span> <span class="pl-v">SSH</span>: <span class="pl-v">ANSIBLE_TIMEOUT</span><span class="pl-c1">/</span><span class="pl-s1">timeout</span> <span class="pl-s1">set</span>: (<span class="pl-c1">-</span><span class="pl-s1">o</span>)(<span class="pl-v">ConnectTimeout</span><span class="pl-c1">=</span><span class="pl-c1">10</span>)
<span class="pl-c1">&lt;</span><span class="pl-s1">gate</span>.<span class="pl-s1">opentech</span>.<span class="pl-s1">local</span><span class="pl-c1">&gt;</span> <span class="pl-v">SSH</span>: <span class="pl-v">PlayContext</span> <span class="pl-s1">set</span> <span class="pl-en">ssh_common_args</span>: ()
<span class="pl-c1">&lt;</span><span class="pl-s1">gate</span>.<span class="pl-s1">opentech</span>.<span class="pl-s1">local</span><span class="pl-c1">&gt;</span> <span class="pl-v">SSH</span>: <span class="pl-v">PlayContext</span> <span class="pl-s1">set</span> <span class="pl-en">ssh_extra_args</span>: ()
<span class="pl-c1">&lt;</span><span class="pl-s1">gate</span>.<span class="pl-s1">opentech</span>.<span class="pl-s1">local</span><span class="pl-c1">&gt;</span> <span class="pl-v">SSH</span>: <span class="pl-s1">found</span> <span class="pl-s1">only</span> <span class="pl-v">ControlPersist</span>; <span class="pl-s1">added</span> <span class="pl-v">ControlPath</span>: (<span class="pl-c1">-</span><span class="pl-s1">o</span>)(<span class="pl-v">ControlPath</span><span class="pl-c1">=</span><span class="pl-c1">/</span><span class="pl-s1">tmp</span><span class="pl-c1">/</span><span class="pl-s1">ansible</span><span class="pl-c1">-</span><span class="pl-s1">ssh</span><span class="pl-c1">-</span><span class="pl-c1">%</span><span class="pl-s1">h</span><span class="pl-c1">-</span><span class="pl-c1">%</span><span class="pl-s1">p</span><span class="pl-c1">-</span><span class="pl-s1"></span><span class="pl-c1">%</span><span class="pl-s1">r</span>)
<span class="pl-c1">&lt;</span><span class="pl-s1">gate</span>.<span class="pl-s1">opentech</span>.<span class="pl-s1">local</span><span class="pl-c1">&gt;</span> <span class="pl-v">SSH</span>: <span class="pl-v">EXEC</span> <span class="pl-s1">ssh</span> <span class="pl-c1">-</span><span class="pl-s1">vvv</span> <span class="pl-c1">-</span><span class="pl-s1">o</span> <span class="pl-v">ControlMaster</span><span class="pl-c1">=</span><span class="pl-s1">auto</span> <span class="pl-c1">-</span><span class="pl-s1">o</span> <span class="pl-v">ControlPersist</span><span class="pl-c1">=</span><span class="pl-c1">60</span><span class="pl-s1">s</span> <span class="pl-c1">-</span><span class="pl-s1">o</span> <span class="pl-v">StrictHostKeyChecking</span><span class="pl-c1">=</span><span class="pl-s1">no</span> <span class="pl-c1">-</span><span class="pl-s1">o</span> <span class="pl-v">Port</span><span class="pl-c1">=</span><span class="pl-c1">22</span> <span class="pl-c1">-</span><span class="pl-s1">o</span> <span class="pl-s">'IdentityFile="id_rsa"'</span> <span class="pl-c1">-</span><span class="pl-s1">o</span> <span class="pl-v">KbdInteractiveAuthentication</span><span class="pl-c1">=</span><span class="pl-s1">no</span> <span class="pl-c1">-</span><span class="pl-s1">o</span> <span class="pl-v">PreferredAuthentications</span><span class="pl-c1">=</span><span class="pl-s1">gssapi</span><span class="pl-c1">-</span><span class="pl-s1">with</span><span class="pl-c1">-</span><span class="pl-s1">mic</span>,<span class="pl-s1">gssapi</span><span class="pl-c1">-</span><span class="pl-s1">keyex</span>,<span class="pl-s1">hostbased</span>,<span class="pl-s1">publickey</span> <span class="pl-c1">-</span><span class="pl-s1">o</span> <span class="pl-v">PasswordAuthentication</span><span class="pl-c1">=</span><span class="pl-s1">no</span> <span class="pl-c1">-</span><span class="pl-s1">o</span> <span class="pl-v">User</span><span class="pl-c1">=</span><span class="pl-s1">k0ste</span> <span class="pl-c1">-</span><span class="pl-s1">o</span> <span class="pl-v">ConnectTimeout</span><span class="pl-c1">=</span><span class="pl-c1">10</span> <span class="pl-c1">-</span><span class="pl-s1">o</span> <span class="pl-v">ControlPath</span><span class="pl-c1">=</span><span class="pl-c1">/</span><span class="pl-s1">tmp</span><span class="pl-c1">/</span><span class="pl-s1">ansible</span><span class="pl-c1">-</span><span class="pl-s1">ssh</span><span class="pl-c1">-</span><span class="pl-c1">%</span><span class="pl-s1">h</span><span class="pl-c1">-</span><span class="pl-c1">%</span><span class="pl-s1">p</span><span class="pl-c1">-</span><span class="pl-c1">%</span><span class="pl-s1">r</span> <span class="pl-s1">gate</span>.<span class="pl-s1">opentech</span>.<span class="pl-s1">local</span> <span class="pl-s">'/bin/sh -c '</span><span class="pl-s">"'"</span><span class="pl-s">'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python &amp;&amp; sleep 0'</span><span class="pl-s">"'"</span><span class="pl-s">''</span>
<span class="pl-s1">gate</span>.<span class="pl-s1">opentech</span>.<span class="pl-s1">local</span> <span class="pl-c1">|</span> <span class="pl-v">UNREACHABLE</span>! <span class="pl-c1">=</span><span class="pl-c1">&gt;</span> {
    <span class="pl-s">"changed"</span>: <span class="pl-s1">false</span>, 
    <span class="pl-s">"msg"</span>: <span class="pl-s">"SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh"</span>, 
    <span class="pl-s">"unreachable"</span>: <span class="pl-s1">true</span>
}</pre></div>
<h5 dir="auto">ISSUE TYPE</h5>
<p dir="auto">Bug Report</p>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">ssh connection plugin</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="spatel@spatel  ~  ansible --version
ansible 2.1.0.0
config file =
configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">spatel@spatel  ~  ansible --version
ansible 2.1.0.0
config file =
configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Mac OSX Yosemite</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Incorrect SSH key permissions yields an invalid error message</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">If the ssh key that you are using to connect to an instance does not have the following perms</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="chmod 0400 yourkey.pem"><pre class="notranslate"><code class="notranslate">chmod 0400 yourkey.pem
</code></pre></div>
<p dir="auto">Then the following error is produced</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="fatal: [52.38.79.205]: UNREACHABLE! =&gt; {&quot;changed&quot;: false, &quot;msg&quot;: &quot;Failed to connect to the host via ssh.&quot;, &quot;unreachable&quot;: true}"><pre class="notranslate"><code class="notranslate">fatal: [52.38.79.205]: UNREACHABLE! =&gt; {"changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true}
</code></pre></div>
<p dir="auto">The host in this case is reachable but the permissions on the key are incorrect, which is what I would expect the error message to say. Running <code class="notranslate">chmod 0400 key.pem</code> fixed the issue.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;52.38.79.205&gt; SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile=&quot;infrastructure/keys/samirpatelme.pem&quot;' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o ControlPath=/Users/spatel/.ansible/cp/ansible-ssh-%h-%p-%r 52.38.79.205 '/bin/sh -c '&quot;'&quot;'( umask 77 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1467733345.17-128997728504951 `&quot; &amp;&amp; echo ansible-tmp-1467733345.17-128997728504951=&quot;` echo $HOME/.ansible/tmp/ansible-tmp-1467733345.17-128997728504951 `&quot; ) &amp;&amp; sleep 0'&quot;'&quot;''"><pre class="notranslate"><code class="notranslate">&lt;52.38.79.205&gt; SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile="infrastructure/keys/samirpatelme.pem"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o ControlPath=/Users/spatel/.ansible/cp/ansible-ssh-%h-%p-%r 52.38.79.205 '/bin/sh -c '"'"'( umask 77 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1467733345.17-128997728504951 `" &amp;&amp; echo ansible-tmp-1467733345.17-128997728504951="` echo $HOME/.ansible/tmp/ansible-tmp-1467733345.17-128997728504951 `" ) &amp;&amp; sleep 0'"'"''
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Invalid permissions on key file</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">fatal: [52.38.79.205]: UNREACHABLE! =&gt; {"changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true}</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate"></code></pre></div>