title: How to solve "paramiko.ssh_exception.SSHException: could not get keys from ssh-agent"
body: <p>I'm trying to connect to remote server through SSH using Paramiko Python module. Installed using Python version 3.6.7 on CentOS 7 server. But getting this following error. </p>
  
  
  
  <pre class="lang-none prettyprint-override"><code>python
  import paramiko
  &gt;&gt;&gt; ssh = paramiko.SSHClient()
  &gt;&gt;&gt; ssh.load_system_host_keys()
  &gt;&gt;&gt; ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  &gt;&gt;&gt; ssh.connect("19.16.2.2", username="user1", password="pass")
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/local/lib/python3.6/site-packages/paramiko/client.py", line 424, in connect
      passphrase,
    File "/usr/local/lib/python3.6/site-packages/paramiko/client.py", line 643, in _auth
      self._agent = Agent()
    File "/usr/local/lib/python3.6/site-packages/paramiko/agent.py", line 372, in __init__
      self._connect(conn)
    File "/usr/local/lib/python3.6/site-packages/paramiko/agent.py", line 68, in _connect
      raise SSHException('could not get keys from ssh-agent')
  paramiko.ssh_exception.SSHException: could not get keys from ssh-agent
  </code></pre>
  
  <p>Note that I don't want to use the SSH agent, just the Paramiko module alone.</p>
  
  <p>I googled and tried the following solutions. Still I was not able to resolve this issue. Would appreciate if provided a solution. Thanks in advance. </p>
  
  <ul>
  <li><p><a href="https://myroughnotes.wordpress.com/2017/03/19/fabric-could-not-get-keys-from-ssh-agent/" rel="nofollow noreferrer">https://myroughnotes.wordpress.com/2017/03/19/fabric-could-not-get-keys-from-ssh-agent/</a></p></li>
  <li><p><a href="https://access.redhat.com/solutions/3571001" rel="nofollow noreferrer">https://access.redhat.com/solutions/3571001</a></p></li>
  <li><p><a href="https://unix.stackexchange.com/questions/82489/how-to-check-which-ssh-keys-are-currently-active">https://unix.stackexchange.com/questions/82489/how-to-check-which-ssh-keys-are-currently-active</a></p></li>
  </ul>
  
  
  
  <pre class="lang-none prettyprint-override"><code># eval ssh-agent -s
  SSH_AUTH_SOCK=/tmp/ssh-PycvG5kzoTjt/agent.26174; export SSH_AUTH_SOCK;
  SSH_AGENT_PID=26175; export SSH_AGENT_PID;
  </code></pre>