Ssh-add always fails when opening a new terminal

I'm trying to use 'ssh-add' so I don't need to put my ssh key in all the time. I've been using this fine on other distros but for some reason on Garuda it's not working. I thought it was fish at first, so I swapped to zsh, but that doesn't work. Even another terminal emulator with good ol' bash doesn't work.

I've looked around for a way to fix it and I can fix it, but only until the terminal is closed. For each new instance I need to get it working again.

How do I get ssh-add to work every time using Alacritty?

Thanks in advance!

EDIT: I included the error below, sorry I forgot to do that.

I suspect you need to add something you your shell rc file, and/or have a running keyring daemon.

What steps do you follow for this?

4 Likes

Maybe this can help?
https://wiki.archlinux.org/title/SSH_keys#Keychain
Or other chapters there, of course... e.g.:
https://wiki.archlinux.org/title/SSH_keys#SSH_agents

4 Likes

It would be super-helpful to know the error you are getting when it fails in order to give you guidance on how to fix it.

5 Likes

Sorry for not providing more information. I've tried ALL of the following methods from here:

Here's the error I am getting every time I open a new terminal of any kind and run 'ssh-add':

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

This happened ever since I installed Garuda, before I changed anything to do with the terminal/shell at all.

1 Like

To solve that follow the guidance in the wiki that talks about auto-starting ssh-agent. There are a couple of different options.

https://wiki.archlinux.org/title/SSH_keys#ssh-agent

2 Likes

With fish, check also if this might be useful:

6 Likes

I've stopped using fish entirely, I don't like it at all. Not being able to pass '$' into the terminal is a total dealbreaker and I don't see any reason to use it over zsh/bash.

I've tried multiple methods here: SSH keys - ArchWiki

Either I am stupid or nothing works. ssh-add gives me the same error as I posted above.

Basically I just want similar functionality to other OSes. That when I run ssh-add I only need to put in my password once. I don't care if this is on boot, or on the first terminal that I open. I need to use ssh so many times a day for work that putting my password in, is just totally tedious.

I'm sorry to ask, but could someone just give me clear instructions on how to do this. I really have tried the above like installing keychain etc. but it's not saving anything when I input my ssh password the first time.

Here's the output:

➜  ~ ssh-add
Could not open a connection to your authentication agent.
➜  ~ ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-XXXXXXkMT84G/agent.58624; export SSH_AUTH_SOCK;
SSH_AGENT_PID=58625; export SSH_AGENT_PID;
echo Agent pid 58625;
➜  ~ ssh-add
Could not open a connection to your authentication agent.
➜  ~

I just want to be able to run ssh-add, be asked for my password once and then that's it.

Instead of ssh-agent, have you tried eval "$(ssh-agent)" or eval $(ssh-agent) (just checking this on some Internet sites)?

I solved the problem. I was editing ~/.bashrc instead of ~/.zshrc because I have changed to zsh, basically nothing in .bashrc is relevant any more.

All I did was add the built-in plugin "ssh-agent" to my .zshrc and now I am prompted for my password every time I open a terminal for the first time after boot. That's exactly what I wanted.

I realise that some of you guys like fish and micro, but I wish you wouldn't have this stuff set to default. It's really, really annoying not being able to parse "$" in the fish shell. I recommend that you just leave users with bash and let them configure the terminal their own way. This was a highly annoying experience and I am just being honest here.

Bash is login shell for all editions these days. Fish is just being used in graphical terminals to have a more userfriendly experience.
Also its not like we force people to use a certain shell. There is even an option for that in the Garuda Assistent, you just need to use it. :wink:

1 Like

Solution was in post #2.


There wouldn't be the biodiversity in the Linux world if everyone liked the same thing.

If you like to work with Vi or Vim, do it.
If Garuda only offered Vi, thousands here would wish we had nano in the DEs.
I used to love nano now it's micro.

Sometimes tastes change. :slight_smile:


"Everyone should be happy according to their own opinion."

3 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.