Skip to main content
March 27, 2024
Question

NixOS SSH-Agent Connection Refused

  • March 27, 2024
  • 2 replies
  • 1469 views

Working on switching to NixOS so this is a new install hasn't worked yet (have had SSH-Agent work on previous Ubuntu install without issue).

When attempting to SSH, I see get_agent_identities: ssh_get_authentication_socket: Connection refused. Polkit is setup (I'm assuming) as I can unlock 1Password with my system password.

I do notice that if I set export SSH_AUTH_SOCK=~/.1password/agent.sock and run ssh-add -l, my keys are there, but trying to SSH even with the environment variable set, I still get the connection refused.

I am confused on what the deal is with the following lines:

debug1: identity file /home/stark/.ssh/id_rsa type -1
debug1: identity file /home/stark/.ssh/id_rsa-cert type -1
debug1: identity file /home/stark/.ssh/id_ecdsa type -1
debug1: identity file /home/stark/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/stark/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/stark/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/stark/.ssh/id_ed25519 type -1
debug1: identity file /home/stark/.ssh/id_ed25519-cert type -1
debug1: identity file /home/stark/.ssh/id_ed25519_sk type -1
debug1: identity file /home/stark/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/stark/.ssh/id_xmss type -1
debug1: identity file /home/stark/.ssh/id_xmss-cert type -1
debug1: identity file /home/stark/.ssh/id_dsa type -1
debug1: identity file /home/stark/.ssh/id_dsa-cert type -1

As I do not have those in my .ssh folder, not sure if this is a random NixOS thing or I'm just not very observant or if this is just a red herring and means absolutely nothing.

```
→ ls ~/.ssh

drwx------ - stark 26 Mar 21:09 󰢬 /home/stark/.ssh
lrwxrwxrwx - stark 26 Mar 21:09 ├──  config -> /nix/store/wwqd0p001xi0g3zdw143lrjzpi4b4d1f-home-manager-files/.ssh/config
.rw------- 928 stark 26 Mar 20:56 ├── 󰣀 known_hosts
.rw-r--r-- 92 stark 24 Mar 11:33 └──  known_hosts.old

SSH log, and Nix config can be found
https://gist.github.com/starkca90/b1a7c06a100b8724a7e63a20bb519229

Thank you much in advance!


1Password Version: 1Password for Linux 8.10.27 (81027003)
Extension Version: Not Provided
OS Version: NixOS 23.11 (unstable nixpkgs)
Browser: Not Provided

2 replies

starkca90Author
March 29, 2024

Figured it out. The NixOS wiki "lies" and has one add "IdentitiesOnly yes" to the SSH config file, which was my problem... If one refers to 1Password's guidance, this line is not included... Got to fix some documentation... WOOT!

https://nixos.wiki/wiki/1Password#1Password.2C_SSH_keys_and_Home_Manager

1Password Employee
April 4, 2024

Hi @starkca90,

I'm glad to hear you were able to resolve the issue! Thanks for sharing the resolution!

Franky