How do you get screen to automatically connect to the current ssh-agent when re-attaching to an existing screen?
Problem
If you start a screen session while ssh-agent is running (from ssh -A agent forwarding), accessing ssh-agent works fine. However, if you detach from that session, log out, log in again (with ssh-agent forwarding), and re-attach to your screen session, ssh-agent access doesn't work. How can this be fixed?
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix for: How do you get screen to automatically connect to the current ssh-agent when re-attaching to an existing screen?
In your SSH rc script (~/.ssh/rc) you will set up a symbolic link from a canonical location to the "current" SSH_AUTH_SOCK. Here's how I do it in bash (content of ~/.ssh/rc): (and make sure to ). The "test" is just to prevent an error from displaying if you aren't running ssh-agent (ie you ssh without ). The second half of that command sets up a symlink in a canonical location that updates itself to the "real" at login time. This is independent of using a shell in ssh or calling a command direc…
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix