Skip to main content
March 17, 2022
Question

Error connecting to agent: No such file or directory

  • March 17, 2022
  • 16 replies
  • 9090 views

I just saw the post & beta for SSH + CLI integration and this seems amazing. +1 Cant wait for the final release.

However, I'm unable to get this working at all.
* I also use a shell called fishshell for what it's worth. (fish, version 3.3.1, but I do not believe this is part of the issue, as I swapped to bash too, and experience the same issue)
* I have installed OpenSSH (OpenSSH_8.6p1)
* 1P CLI is on version 2.0.0

I've run both the "configuration" commands per the docs.

I've created the symlink using

mkdir -p ~/.1password && ln -s ~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock ~/.1password/agent.sock

...and added the additional line to the ssh config

Host *
IdentityAgent "~/.1password/agent.sock"
IdentitiesOnly yes

I also added the SSH_AUTH_SOCK to my profile, even tried the global config from https://developer.1password.com/docs/ssh/agent/compatibility#configure-ssh_auth_sock-globally-for-every-client

I've check that I have all the requirements.
* Private vault
* New Key generated via 1Password
* Not archived

But when I run

ssh-add -l

I keep getting a response of Error connecting to agent: No such file or directory, and also any github cli interactions refuses to connect, but I believe its all caused by one in the same issue

Any ideas of what I might be missing?


1Password Version: 8.6.0
Extension Version: Not Provided
OS Version: 12.2.1 (21D62)
Referrer: forum-search:https://1password.community/search?Search=ssh

16 replies

March 18, 2022

I assume you meant the SSH agent. So I did toggle that.

  1. I cleared the logs (made a backup first)
  2. Toggled both SSH + CLI

There are 2 errors below: (included the into logs too fwiw)

```
INFO 2022-03-18T12:49:49.842 tokio-runtime-worker(ThreadId(4)) [1P:native-messaging/op-native-core-integration/src/lib.rs:299] Setting has been toggled on/off, restarting native core integration
INFO 2022-03-18T12:49:49.842 tokio-runtime-worker(ThreadId(4)) [1P:native-messaging/op-native-core-integration/src/lib.rs:281] Starting IPC listener on 2BUA8C4S2C.com.1password.browser-helper
INFO 2022-03-18T12:49:49.842 tokio-runtime-worker(ThreadId(4)) [1P:op-ipc/src/ipc/xpc.rs:155] XPC starting connection

ERROR 2022-03-18T12:49:49.843 tokio-runtime-worker(ThreadId(4)) [1P:native-messaging/op-native-core-integration/src/connection_handler.rs:37] Dropping connection with b5x due to error handling outgoing message: EndConnection

INFO 2022-03-18T12:49:49.864 tokio-runtime-worker(ThreadId(10)) [1P:op-ipc/src/ipc/xpc.rs:197] XPC connected to 2BUA8C4S2C.com.1password.browser-helper
INFO 2022-03-18T12:49:49.864 tokio-runtime-worker(ThreadId(10)) [1P:native-messaging/op-native-core-integration/src/lib.rs:293] Active native core integration is awaiting messages
INFO 2022-03-18T12:49:49.864 tokio-runtime-worker(ThreadId(10)) [1P:native-messaging/op-native-core-integration/src/lib.rs:305] Extension connecting.
INFO 2022-03-18T12:49:49.864 tokio-runtime-worker(ThreadId(10)) [1P:native-messaging/op-native-core-integration/src/lib.rs:307] Extension connection accepted.
INFO 2022-03-18T12:49:58.267 tokio-runtime-worker(ThreadId(6)) [1P:ssh/op-agent-controller/src/desktop.rs:285] SSH Agent has started.
INFO 2022-03-18T12:50:00.319 tokio-runtime-worker(ThreadId(7)) [1P:native-messaging/op-native-core-integration/src/lib.rs:448] Enabling BrowserHelper with bundle id: 2BUA8C4S2C.com.1password.browser-helper
INFO 2022-03-18T12:50:00.325 tokio-runtime-worker(ThreadId(7)) [1P:native-messaging/op-native-core-integration/src/lib.rs:299] Setting has been toggled on/off, restarting native core integration
INFO 2022-03-18T12:50:00.325 tokio-runtime-worker(ThreadId(7)) [1P:native-messaging/op-native-core-integration/src/lib.rs:281] Starting IPC listener on 2BUA8C4S2C.com.1password.browser-helper
INFO 2022-03-18T12:50:00.325 tokio-runtime-worker(ThreadId(7)) [1P:op-ipc/src/ipc/xpc.rs:155] XPC starting connection

ERROR 2022-03-18T12:50:00.325 tokio-runtime-worker(ThreadId(7)) [1P:native-messaging/op-native-core-integration/src/connection_handler.rs:37] Dropping connection with b5x due to error handling outgoing message: EndConnection

INFO 2022-03-18T12:50:00.342 tokio-runtime-worker(ThreadId(6)) [1P:op-ipc/src/ipc/xpc.rs:197] XPC connected to 2BUA8C4S2C.com.1password.browser-helper
INFO 2022-03-18T12:50:00.342 tokio-runtime-worker(ThreadId(6)) [1P:native-messaging/op-native-core-integration/src/lib.rs:293] Active native core integration is awaiting messages
INFO 2022-03-18T12:50:00.342 tokio-runtime-worker(ThreadId(6)) [1P:native-messaging/op-native-core-integration/src/lib.rs:305] Extension connecting.
INFO 2022-03-18T12:50:00.342 tokio-runtime-worker(ThreadId(6)) [1P:native-messaging/op-native-core-integration/src/lib.rs:307] Extension connection accepted.

```

floris_1P
1Password Employee
March 18, 2022

And another question, just to verify: when you moved the keys to your Personal vault, was that on the same machine where you're running the SSH agent on? Because for the SSH agent to sync your change, it needs to be unlocked once first.

March 18, 2022

All of this is on my local dev machine. 1P + SSH etc
I mean... I could try physically restarting it... Which I haven't actually thought of doing yet 😂

[Update]
My Mac & 1Password has been Restarted & unlocked. No luck.

March 19, 2022

And I think in all of the moving backwards & forwards I might have not put the ssh keys in the right vault.

I did verify it again now, and they keys are in the right vault. (I have 2 SSH keys... But I see that also causes an issue, because I don't know how to specify with 1Password to use which hey for which gh account, so for now, I'm just using the one)

I have 2 MacBooks, a personal one, and one for work.

My personal machine:
* Worked fine. Did the upgrade to 1Password 8 (App + Browser Plugin).
* SSH sees my keys + I can login to github

Work machine:
```
~/.ssh  ssh-add -l

finally returns the key that is inside the vault! 🥳

~/.ssh  ssh -T mailto:git@github.com

fails

~/.ssh  ssh -o 'IdentitiesOnly=no' -T mailto:git@github.com

succeeds! 🥳

```

I then removed the IdentiesOnly flag from my .ssh/config and I can now login to gh using the SSH key stored in 1 Password.

This is probably a question for another thread.

But is there a way to specify which key to use for which gh repo?
```
Host *
IgnoreUnknown UseKeychain
AddKeysToAgent yes
UseKeychain yes
IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"

Host smg.github.com
HostName github.com
User git
IdentityFile ~/.ssh/rohan_smg_generated. # I would like to move this to 1Password too

Host github.com
HostName github.com
User git
```

March 19, 2022

And solved it! 🥳

Use this https://developer.1password.com/docs/ssh/agent/advanced#match-key-with-host setup

floris_1P
1Password Employee
March 21, 2022

Glad you got it working! The docs have been updated now to mention both the Private and Personal vault.