ssh-add -l | ssh-add -x | ssh-add -X | ssh-copy-id |

After installing Ubuntu 16.04 I recreated my ssh keys as I forgot to back them up, but whenever I attempt to use ssh I get sign_and_send_pubkey: signing failed: agent refused operation this is slightly annoying as it lets me through to my ssh server, but git refuses to push code using ssh.
I have already pushed the keys to the server by using ssh-copy-id.
Looks like an ssh-agent is running already but it can not find any keys attached. To solve this add the private key identities to the authentication agent like so:
ssh-add

ssh-add # This will load your key into the ssh-agent session so that you can login to hosts without requiring your passphrase each time

Then you can ssh into your server.
in addition, you can see the list of fingerprints of all identities currently added by:
ssh-add -l
Example with ssh-add ~/.ssh/id_rsa
  1. Ensure the ssh-agent is running:
    • If you are using the Git Shell that's installed with GitHub Desktop, the ssh-agent should be running.
    • If you are using another terminal prompt, such as Git for Windows, you can use the "Auto-launching the ssh-agent" instructions in "Working with SSH key passphrases", or start it manually:
      # start the ssh-agent in the background
      eval $(ssh-agent -s)
      Agent pid 59566
      
  2. Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.
    ssh-add ~/.ssh/id_rsa

Lock (or) Unlock the SSH Agent

You can lock the ssh agent as shown below using -x option. Once you lock the agent, you cannot add, delete, or list entries in the ssh agent without a password.
$ ssh-add -x
Enter lock password:
Again:
Agent locked.
After locking, if you try to add, you’ll se SSH_AGENT_FAILURE message as shown below.
$ ssh-add
SSH_AGENT_FAILURE
SSH_AGENT_FAILURE
Could not add identity: /home/ramesh/.ssh/id_rsa
To unlock an agent, use -X option as shown below. Make sure you enter the same password that you gave while locking the agent. If you give a wrong password, you’ll set “Failed to unlock agent.” message.
$ ssh-add -X
Enter lock password:
Agent unlocked.

Comments

Popular posts from this blog

HAproxy logging

teamcity Automatic Agent Start under Linux

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all