We have a build system that needs an active ssh connection with mercurial and to do so, it needs an ssh-agent
loaded with a key constantly..
The thing is that, even though that after creating the ssh agent eval $(ssh-agent -s)
and setting up the environment variables:
- SSH_AUTH_SOCK
- SSH_AGENT_PID
Doing env | grep SSH
:
SSH_AGENT_PID=7601
SSH_CLIENT=***.***.***.*** 53371 22
SSH_AUTH_SOCK=/tmp/ssh-4gJ9y89gPzbg/agent.7600
SSH_CONNECTION=***.***.***.*** 53371 10.0.67.4 22
After I log out from them EC2 Instance, after a few hours of the program running and pulling repos, etc. It would suddenly get this error:
CommandError: (-1, 'remote: ssh_exchange_identification: Connection closed by remote host', 'abort: no suitable response from remote hg!')
Then when I go and check the env | grep SSH
the only thing that is setup is the SSH_CONNECTION
and the SSH_CLIENT
.
Why would this occur? Are these environment variables only setup in the session?
And if so, why would it only fail after long hours of already logging out?
How can I make so that these environment variable are always there so that it doesn't break my program by not having these 2 environment variables setup?
screen
ortmux
on the remote host?screen
ortmux