Netlify SSH Deploy key private key location


I need to access my Netlify SSH deploy key private key from my build environment. Where is the SSH private key stored in the machine?


There’s no SSH, probably. Why do you need one if I may ask?

I need an SSH private key in my application to connect to a server. The key is on my machine and it’s .gitignore-d and I don’t want to commit it.

Since Netlify has a concept of SSH deploy keys to access private git repos registered as submodules, I figured the key would be in the build container and I could use this concept of deploy keys to provide myself with an SSH key for my own purposes.

Oh those ones. Are you looking for this: Repository permissions and linking | Netlify Docs?

1 Like

I am familiar with that page. I am looking for the corresponding private key in the build environment to the deploy keys I create

I’m not entirely sure this is possible… and to be honest I don’t quite understand a use case for it either.

As the page mentions, the private key is stored with Netlify and it’s probably hidden and only the public one is visible to you.

1 Like

I mean, it is used to pull the submodules at build time. That means it’s probably in the build environment somewhere.

As far as the use case goes: as I said, the software can connect via SSH to a remote server. I can use another service instead of Netlify if there’s no way for me to have an SSH private key in Netlify safely.

From my understanding, you can only see the public key, not the private one sadly.

1 Like

I found the key by the way, it’s in /opt/build/deploykey

It’s not accessible unfortunately as it’s owned by root with rw permissions for its owner only, while the Netlify build process is done by user buildbot (and there’s no sudo)

1 Like

Thanks for sharing this @Valerio_Versace! People like you help make Netlify Community great :grinning:

Hi, @Valerio_Versace. I think the missing information is this:

  • Why do you want to SSH from the build image to another system during the build? What is the purpose of making the SSH connection during the site build process?

Once we understand the goal, we will be able to better answer this question.