How can I get my ssh keys and identity into ddev's web container?
Asked Answered
P

2

8

I have these needs from time to time in the web container:

  • ssh to a server from inside the web container
  • Use git to a private repository inside the web container
  • Use rsync (like ddev drush rsync)
  • Use ddev composer with access to private repositories

So how can I get my keys into the container?

Paine answered 27/6, 2018 at 14:13 Comment(0)
P
17

DDEV supports having your ssh keys in the container without mounting them there, using an ssh-agent inside docker.

You can authenticate and add your keys via ddev auth ssh, and they will then be available from every project. This works for ssh from inside the container, private composer repositories, and drush rsync.

See https://ddev.readthedocs.io/en/stable/users/basics/cli-usage/#ssh-into-containers for docs.

Paine answered 27/6, 2018 at 14:13 Comment(7)
could you please highlight the valid response more and seperate it more freom the obsolete response? Was a bit confusing at first...Wallen
Note: ddev auth ssh will only add keys in OpenSSH formatSivia
Under which path can I find the keys in the web container after running ddev auth ssh? If I ddev ssh into the container and look in the ~/.ssh directory, there is only a config file, but no key files.Scuff
The whole idea of ddev auth ssh is that the keys don't go into the web container. They're served by an ssh agent running in the ddev-ssh-agent container.Paine
If you really want the ssh keys inside the container you can do it, see https://mcmap.net/q/1323971/-when-i-try-to-use-ssh-in-ddev-web-container-after-ddev-auth-ssh-the-ssh-keys-don-39-t-seem-to-work-quot-too-many-authentication-failures-quotPaine
The ddev link in the answer is broken . You find it at ddev.readthedocs.io/en/latest/users/basics/cli-usage/…Huntsman
Thanks @Huntsman - I fixed the link and added a redirect in the docs.Paine
B
0

I am having an issue that popped up after updating mac that I simply cannot fix. My yaml files are not ommitting ssh but I get this error, all the time.

ddev-ssh-agent is omitted in your configuration so ssh auth cannot be used

Bourgeon answered 5/9, 2023 at 18:26 Comment(1)
Please don't post a question as if it were an answer. If you're getting ddev-ssh-agent is omitted in your configuration so ssh auth cannot be used that means that you have omit_containers: [ssh-agent] in your global configuration - in ~/.ddev/global_config.yaml - that's the global_config.yaml file in the .ddev folder in your home directory.Paine

© 2022 - 2024 — McMap. All rights reserved.