Skip to content

Conversation

Copy link

Copilot AI commented Nov 5, 2025

OpenSSH moved agent sockets from /tmp to ~/.ssh/agent with a new naming pattern: s.<hash>.agent.<random> instead of agent.<pid>.

Changes

Search path - Added ~/.ssh/agent to default socket search locations while preserving /tmp priority

Socket patterns - Extended find/grep to match new socket format:

# Old: /tmp/ssh-xxx/agent.12345
# New: ~/.ssh/agent/s.8f4932df.agent.AzSubDP0S1

PID extraction - Conditional extraction based on socket name format:

  • Old-style (agent.\d+): extract PID using BASH_REMATCH
  • New-style (s.*. agent.*): skip extraction (PID not in filename)

Backward compatible with existing /tmp sockets, SSH_FIND_AGENT_PATH, and TMPDIR configurations.

Original prompt

This section details on the original issue you should resolve

<issue_title>Broken after OpenSSH's commit: moved agent listener sockets from /tmp to ~/.ssh/agent</issue_title>
<issue_description>First of all, thank you for your work! I've been using this tool for quite some time. :)

Now, after OpenSSH's commit openssh/openssh-portable@80162f9, the agent listener sockets were moved from /tmp to ~/.ssh/agent. Their reasoning is the following:

This ensures processes (such as Firefox) that have restricted filesystem access that includes /tmp (via unveil(3)) do not have the ability to use keys in an agent.

Fortunately, the -T flag on the ssh-agent command will return to placing the agent socket into the /tmp directory.

# ~/.bashrc or ~/.zshrc
ssh-add -l >&/dev/null || ssh-find-agent -a || eval $(ssh-agent -T) > /dev/null

Is updating this tool to consider the ~/.ssh/agent directory a good idea? Unfortunately, the name of the socket file does not appear to have the PID of the SSH agent in it anymore. It only appears to have a randomized string. E.g.:

$ eval $(ssh-agent)
Agent pid 11434

$ echo "$SSH_AUTH_SOCK"
/home/<user>/.ssh/agent/s.<hash_of_hostname>.agent.AzSubDP0S1
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
<comment_new><author>@wwalker</author><body>
Thank you.  I'll look into getting that change in soon.
</body></comment_new>
</comments>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits November 5, 2025 22:37
Co-authored-by: wwalker <23478+wwalker@users.noreply.github.com>
Co-authored-by: wwalker <23478+wwalker@users.noreply.github.com>
Co-authored-by: wwalker <23478+wwalker@users.noreply.github.com>
Copilot AI changed the title [WIP] Update agent listener socket to use ~/.ssh/agent Support OpenSSH's new ~/.ssh/agent socket location Nov 5, 2025
Copilot AI requested a review from wwalker November 5, 2025 22:48
Copilot finished work on behalf of wwalker November 5, 2025 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken after OpenSSH's commit: moved agent listener sockets from /tmp to ~/.ssh/agent

2 participants