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).