Question

I'd like to have a public key on a Heroku server. I run

$ heroku run bash
Running `bash` attached to terminal... up, run.2575
~ $ ssh-keygen -t rsa
~ $ ls .ssh/
id_rsa  id_rsa.pub

Everything is okay now. But when I rerun heroku run bash the .ssh directory disappears.

So the question is: is there any way to create permanent public key?

Était-ce utile?

La solution

Heroku manages access control to all of the server instances.

When you run heroku run bash it's spinning up a new dyno, SSHing into it, and executing bash on that server. When you log out, that dyno goes away.

You should rely on Heroku for your access control. You might be able to configure .ssh keys using a custom Heroku buildpack, but there's still no way to connect directly other than through the Heroku app (since they manage what dynos are running and how to connect to them).

Autres conseils

There is a way to store keys outside the Heroku application: generate keys and store it in an environment variable which can be added with:

heroku config:add ENV_VAR_NAME=value
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top