Error to open a connection to "ssh-agent" when running "ssh-add" command

Solution Verified - Updated -


Having the following scenario where:

  • A passphrase was set for the rsa key pair to use in SSH connections
  • Trying to run ssh-add to store the passphrase so there is no need to enter it each time a connection is initiated with a remote machine

Error messages like the following ones are the output:

# ssh-add 
Could not open a connection to your authentication agent.

# ssh-add
Error connecting to agent: No such file or directory


  • Red Hat Enterprise Linux
    • 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content