0

I've started using Amazon EC2 recently. I've setup a "permanent" Spot instance, I log in using ssh keys, then I clone some GitHub repos (using another ssh key pair).

The problem is, dispite the fact that EC2 instance is permanent, each new login session I do, I have to setup the ssh keys all over again (both to log in to EC2, and to pull repo from GitHub into EC2), with the following commands:

> eval "$(ssh-agent -s)"
> ssh-add ~/.ssh/mykey

Why isn't this permanently added?

Danijel
  • 188
  • As to "why" - because you're not telling the system to do it each time you log in. Logging out stops the ssh-agent process. – Panki Jun 14 '23 at 17:19
  • Dang it, I picked the wrong dupe. https://unix.stackexchange.com/questions/90853/how-can-i-run-ssh-add-automatically-without-a-password-prompt The next person to read this: please mark as dupe :) – Panki Jun 14 '23 at 17:20
  • Are you telling me that just running the agent would be enough to make this a permanent key, without having to add it ssh-add ~/.ssh/mykey each time? – Danijel Jun 15 '23 at 07:43

0 Answers0