You are not logged in.
Pages: 1
I have the problem that my ssh-agent doesn't remember my ssh keys, even if I add them with ssh-add.
My key is located in "~/.ssh/id_rsa". Ssh-agent should automatically recognize this key and remember the password if I type it. The output of "ssh-add -l" is "The agent has no identities.". If I add the key with ssh-add it will work fine until I log out.
The ssh-agent service is enabled and active, so that can't be the problem either.
What could cause this problem, and how do I solve it.?
Last edited by TheStroyer (2019-10-17 09:47:07)
Offline
What are you trying to do?
Try
#ssh username@hostname/IPSubstitute username for a username defined on the ssh server and use the hostname OR ip address (of the server).
Make sure the host knows you public key. and "allow password login" is disabled.
Edit: I've been playing around with this, getting ssh'd into a freshtomato router using just the rsa key generated by openssh.
I didn't have to do anything on the client side besides generate the key. on the server side I had to copy/paste the generated public key into the proper field then save the config and restart the ssh service.
ssh-keygenI didn't set a password on the keys cause I'm just messing around.
Last edited by Zod (2019-10-16 02:05:20)
Offline
I use Keychain
Works great for my SSH and GPG keys.
Eenie meenie, chili beanie, the spirits are about to speak -- Bullwinkle J. Moose
It's a big club...and you ain't in it -- George Carlin
Registered Linux user #149839
perl -e 'print$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10); '
Offline
Which ssh-agent service did you enable? If you are running a user service as described here, then it is probably stopped when you log out. Try setting the service to linger.
Leaving the keys in memory when logged out just to avoid retyping a password seems like an unnecessary security trade-off.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
What are you trying to do?
I'm trying to connect to my server without having to type my (ssh key) password every time.
Try
#ssh username@hostname/IP
I did that and I'm able to log in when I provide the password. This works as expected. But when I log out of the server and log in again, I have to provide my password again. I expect the ssh-agent to remember my key for the second time so I don't have to provide my password multiple times.
I use Keychain
Works great for my SSH and GPG keys.
That looks like a great program, but it is only useful if I use multiple keys. At the moment I use only one, so I'll stick with ssh-agent for the moment.
Which ssh-agent service did you enable?
I have installed open-ssh and enabled ssh-agent with systemctl --user enable ssh-agent.service.
Leaving the keys in memory when logged out just to avoid retyping a password seems like an unnecessary security trade-off.
I believe I should state my goal more clearly: I want ssh-agent to remember my keys while I'm logged into my client pc. If I log into my server multiple times in one session, I want to type my (ssh key) password just once. It's ok that if I log out of my pc, ssh-agent removes my keys from memory.
However, what is happening now is that ssh agent doesn't remember my keys at all. I have added my key with ssh-add. When I log into my server it askes the password only once. But when I reboot my pc, I try to log into my server and it askes my password every time.
On my other pc I did exactly the same but there it just works.
Offline
I have added my key with ssh-add. When I log into my server it askes the password only once.
Something doesn't stack up there.
If this password is for the ssh key then ssh-add will prompt for a passphrase:
# ssh-add
Enter passphrase for .ssh/id_rsa:When you login to the server it's not expected for there to be password prompts.
#ssh username@hostname/IPI did that and I'm able to log in when I provide the password. [...] I expect the ssh-agent to remember my key for the second time.
Sorry to burst your bubble but plain ssh won't add keys to the agent. You need to use ssh-add to add the key.
--
saint_abroad
Offline
Something doesn't stack up there.
If this password is for the ssh key then ssh-add will prompt for a passphrase:
# ssh-add Enter passphrase for .ssh/id_rsa:
That's right. That is what it did.
Sorry to burst your bubble but plain ssh won't add keys to the agent. You need to use ssh-add to add the key.
On my other pc, I only have to do
#ssh username@hostname/IPand it will remember the password I provided. It will then automatically provide the key to the server when I try to log into the server again. I am trying to replicate that behavior on my other pc.
Last edited by TheStroyer (2019-10-16 12:47:08)
Offline
I am trying to replicate that behavior on my other pc.
I don't know what this other PC is doing but, if I were to hazard a guess, I'd say it's using dbus socket-activation on SSH_AUTH_SOCK to start Gnome Keyring SSH Agent which automatically loads ssh keys on startup, which is when the agent is first accessed.
Can confirm by what SSH_AUTH_SOCK is set to for each.
Last edited by sabroad (2019-10-16 15:40:31)
--
saint_abroad
Offline
Sorry to burst your bubble but plain ssh won't add keys to the agent. You need to use ssh-add to add the key.
Apparently, this is wrong.
Try AddKeysToAgent.
Last edited by sabroad (2019-10-16 15:49:58)
--
saint_abroad
Offline
Try AddKeysToAgent.
Ah this is the thing that does it. I didn't think to look at my ssh config on the pc that automatically saves keys, but the ~/.ssh/config says:
AddKeysToAgent yesI added that on my other pc and it worked. Thanks a lot!
Offline
Pages: 1