SSH Agent Forwarding Troubleshooting (Windows → Linux Jump Box)
Problem
Running on the jump box:
ssh-add -l
Error:
Could not open a connection to your authentication agent.
Or on Windows:
ssh-add %USERPROFILE%\.ssh\id_ed25519
Error:
Error connecting to agent: No such file or directory
Root Cause
The local Windows OpenSSH Authentication Agent (ssh-agent) was not running.
Without a running local SSH agent:
ssh-addcannot load the private key.ssh -Ahas no identities to forward.The jump box cannot access the forwarded SSH key.
Troubleshooting Steps
1. Check the SSH Agent status (Windows)
sc query ssh-agent
If the output contains:
STATE : STOPPED
the service must be started.
2. Enable automatic startup
Run Command Prompt as Administrator:
sc config ssh-agent start=auto
3. Start the SSH Agent
net start ssh-agent
Expected:
The OpenSSH Authentication Agent service was started successfully.
4. Add the private key
ssh-add %USERPROFILE%\.ssh\id_ed25519
Expected:
Identity added:
5. Verify locally
ssh-add -l
Expected:
256 SHA256:...
6. Connect with agent forwarding
ssh -A user@jumpbox
7. Verify on the jump box
Check forwarded identities:
ssh-add -l
Or verify the forwarded socket:
echo $SSH_AUTH_SOCK
If a valid socket path is displayed, agent forwarding is active.
Common Errors
Error
Error connecting to agent: No such file or directory
Cause:
Local SSH agent is not running.
Error
The agent has no identities.
Cause:
SSH agent is running.
No private keys have been added.
Fix:
ssh-add %USERPROFILE%\.ssh\id_ed25519
Error
Could not open a connection to your authentication agent.
Cause:
Agent forwarding is not working.
SSH agent is not running.
Remote server does not allow agent forwarding.
Useful Commands
Check service:
sc query ssh-agent
Start service:
net start ssh-agent
Add key:
ssh-add %USERPROFILE%\.ssh\id_ed25519
List identities:
ssh-add -l
Connect with forwarding:
ssh -A user@jumpbox
Verify on Linux:
echo $SSH_AUTH_SOCK
ssh-add -l
Debugging Flow
ssh-add fails on Windows
│
▼
Check ssh-agent service
│
├── Stopped
│ │
│ ▼
│ Start ssh-agent
│ │
▼ ▼
Add private key (ssh-add)
│
▼
Verify (ssh-add -l)
│
▼
SSH with -A
│
▼
On jump box:
echo $SSH_AUTH_SOCK
│
├── Empty
│ └── Agent forwarding not working
│
└── Path exists
│
▼
ssh-add -l
│
▼
Forwarding successful
Comments
Post a Comment