I have started using my Windows 10 for Rails development and am using Linux subsystem for the same.
Recently I faced an issue connecting to a remote machine via SSH from the terminal. The public key is already available on the remote machine.
After doing some troubleshooting based on the resources I found on web I noticed that SSH agent was not running because ssh-add -l
command didn't provided the expected output.
To make the SSH agent launch on startup I followed the instructions at https://github.com/abergs/ubuntuonwindows#2-start-an-bash-ssh-agent-on-launch and it worked flawlessly.
Now that SSH agent launches automatically I added my identity file to it using command ssh-add path/to/identity/file
..
Note that while generating SSH keys I used custom file name id_work_gmail and id_work_gmail.pub. Thus I had to add it to the agent using above command.
After doing that I can successfully connect to remote machine through SSH.
Until this everything was going smooth. However as soon as I closed each of the Cmder Ubuntu Bash consoles and started a new one ssh-add -l
informed The agent has no identities.. So again I had to add my custom-named identity file to the agent.
So this is something I need to do every-time I kill each of the Ubuntu Bash consoles and start a fresh one.
My question is how can we make the ssh-add path/to/identity/file/custom-named
action persistent like it happens on actual Ubuntu machine. And am curious to know what is it that makes it a one-time activity on Ubuntu machine and a repeated activity on Windows 10 Linux Subsystem.
Thanks.