You are not logged in.

#1 2018-12-18 14:33:16

pokoj42bnaintru
Guest

Does not work adding SSH key to SSH agent

Hi.

ps aux | grep ssh

root     8013     0.0.     0.0     5780     471     ?     Ss     15:14     0:00     ssh-agent -s

I generated key to /home/user/.ssh: there are id_rsa and id_rsa.pub

Can I use private or .pub key for SSH auth on GitHub?

And ssh-add .ssh/id_rsa or ssh-add .ssh/id_rsa.pub does not work for me.
Error message:

Could not open a connecton to your authentication agent.

What is wrong?

P.S. All things in terminal I do with root.

Last edited by pokoj42bnaintru (2018-12-18 14:33:53)

#2 2018-12-18 14:48:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,531
Website

Re: Does not work adding SSH key to SSH agent

pokoj42bnaintru wrote:

What is wrong?

P.S. All things in terminal I do with root.

The P.S. is what's wrong.  Do not randomly run things as root.  Ssh-add looks in ~/.ssh which when run as root is /root/.ssh/ not /home/$USER/.ssh.  Run it as your user and post the complete command and output here if it still fails.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2018-12-18 16:09:56

pokoj42bnaintru
Guest

Re: Does not work adding SSH key to SSH agent

OK, SSH key was created in /home/$USER/.shh/idea_rsa: and there are two files.

When I tried it with root, it had created two files in the same directory.

Then I started the ssh-agent with eval "$(ssh-agent -s)".

Then:

ssh-add .ssh/id_rsa/id_rsa
Permision denied
sudo ssh-add .ssh/id_rsa/id_rsa
Could not open a connection to your authentication agent.


My previous ask:
Can I use private or .pub key for SSH auth on GitHub?

Last edited by pokoj42bnaintru (2018-12-18 16:10:37)

#4 2018-12-27 03:23:03

crmullins
Member
Registered: 2014-04-08
Posts: 27

Re: Does not work adding SSH key to SSH agent

Here [1] is a link to the wiki article you should read to familiarize yourself with how these keys work. I know it looks long but it'll help you understand the process better and give you some guidepost instructions to follow so you can tell us exactly where it goes wrong.

The basic outline is (1) generate your key pair, (2) add your private key to the ssh agent, (3) copy your public key to your github account, (4) test your connection with `ssh -T git@github.com` to make sure it works with github (you can pass -i /path/to/private_key if that helps) and then (5) add an entry to your ~/.ssh/config specifying this private key to use for every request to github.com -- this is useful if you want to have different keys for other purposes and dont want to specify them each time.

Also take a glance at [2], the instructions github provides are generally simple and good.


[1] https://wiki.archlinux.org/index.php/SSH_keys
[2] https://help.github.com/articles/adding … b-account/

Offline

Board footer

Powered by FluxBB