1

I recently updated my Macbook to macOS Ventura 13.1, and ever since that I've had trouble using SSH. This has always kind of "just worked", I've always been able to just ssh to a host and a popup would prompt me to unlock the relevant key. I've never given it much thought.

However, since I upgraded, there doesn't seem to be anything standing in for a SSH agent anymore:

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

$ env | grep -i ssh
SSH_AUTH_SOCK=/gcr/ssh

$ file /gcr/ssh
/gcr/ssh: cannot open `/gcr/ssh' (No such file or directory)

I'm currently working around this by launching ssh-agent in the current shell:

$ eval "$(ssh-agent)"
$ ssh-add ~/.ssh/...
$ ssh my-target-host

I have Googled this to death, but it really seems like I'm the only person in the world with this issue.

As I don't really know how the SSH agent was working in the first place, I have no idea where to start looking. I suspect it was the macOS keychain?

How was this working in the first place, and why did it stop working?

1
  • woah you don't know how it was working in the first place? It looks like it's been messed with/tweaked pretty seriously for that... Not gonna be able to help you with how it was working in the first place, but maybe I can get it to work like it's supposed to (by default) without the workaround. First can you confirm that $ which -a ssh-agent only gives /usr/bin/ssh-agent? Then make sure that $ launchctl print gui/$(id -u)/com.openssh.ssh-agent says running, program is /usr/bin/ssh-agent with argument -l? Commented Feb 13, 2023 at 22:25

1 Answer 1

3

Alright, it turns out there's a good reason I couldn't Google this issue. It was entirely self-inflicted. I sync my .zprofile and .zshrc files across all my computers, all of which run Linux except this Macbook.

Somewhat recently (around the same time as I updated the Macbook to Ventura) started using Gnome's Keyring SSH agent on my Linux machines. That involved adding this line to .zprofile:

export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gcr/ssh"

This resolved to /gcr/ssh on the Macbook and overwrote the OS-provided SSH_AUTH_SOCK variable, which should look something like:

SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.XJ4sRgc4gr/Listeners

I moved this line to a Linux-specific block like this, which fixed the issue:

# Very Linux specific stuff here
if [[ "$(uname)" == "Linux" ]]; then
    # ...

    # Gnome Keyring SSH agent
    export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/gcr/ssh
fi
1
  • 1
    Ah that makes a lot more sense, I thought you had somehow installed gnome crypto and got it to work with keychain and I couldn't even imagine how you would do that Commented Feb 15, 2023 at 19:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .