Open 532910 opened 6 years ago
Did a quick search on the subject, and i suggest to read this: understanding ssh-agent and ssh-add
My assumption is, that your shell script is spawning an ssh-agent, an this way you have the $SSH_AUTH_SOCK
set, but that variable may point to an instance of ssh-agent which does not list your keys (it is empty maybe)
So the best way would be to use this project to set up the agent, and the socket variable properly:
ssh-find-agent
I have an extra info, at least for sudo inside a screen session, it is strongly advised for sudo <= 1.8.5
to add Defaults env_keep += "SSH_AUTH_SOCK"
and you can always look for multiple ssh-agents, and try to keep only one
Interestingly I needed to add that to my sudo config even with Debian Buster's current version of sudo, 1.8.27
Directly from console all works fine: