Question

Why using eval ssh-agent -s ssh-add ~/.ssh/id_rsa to SSH into a Debian droplet created using Terraform CLI?

Posted November 26, 2019 1.1k views
DigitalOceanDeploymentTerraform

Hi everyone,

I developed a bash script which uses Terraform CLI to deploy a Debian 10 droplet. I noticed that to SSH into a server like that using my SSH private key, I have to type in the following commands, as in this thread https://www.digitalocean.com/community/questions/permission-denied-after-creating-droplet-using-ssh-keys

eval ssh-agent -s
ssh-add ~/.ssh/id_rsa

I tried creating the same Debian 10 droplet from Digitalocean GUI and in this case I did not have to type in the ssh-agent and ssh-add commands.

Why this difference?

Are there some flags or options to set to avoid using the previous ssh commands?

Thank you

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Are you access the Debian machine in the same terminal? Once you start the agent and load your key, it should be good for the life of that session to access any systems using that key.

  • Yes, I can access the Debian machine in the same terminal, but that’s not the point. The point is that there if I deploy a Debian droplet using Terraform, I have to load ssh-agent and add my ley to SSH into it, while if I deploy the same Debian VM from Digitalocean GUI, I do not need to load ssh-agent and add my key.

    The actual point is Why this difference? I would like to prevent Debian VM users from loading ssh-agent and adding their private key each time.

Submit an Answer