Shelly is an erlang OTP application that makes it simple to have a remote shell into your application.
Running a SSH daemon in erlang is already very simple. This is a general purpose micro application that you can include in your OTP application enabling remote SSH directly into the BEAM.
Shelly uses the following environment variables:
Variable | Default | Description |
---|---|---|
SHELLY_PORT | 22 | Shelly listens for incoming SSH connections on this port |
SHELLY_ENABLED | true | Shelly is enabled when this value is true |
SHELLY_SYSTEM_DIR | priv/ssh | Shelly uses this directory to find the host key |
SHELLY_USER_DIR | priv/ssh | Shelly uses this directory to find authorised_keys |
SHELLY_AUTHORIZED_KEYS | The authorized keys to use overriding SHELLY_USER_DIR |
Assuming that ~/.ssh
contains an authorized_keys
file, typical usage:
SHELLY_USER_DIR=~/.ssh SHELLY_PORT=22022 make shell
Or:
SHELLY_PORT=22022 SHELLY_AUTHORIZED_KEYS="$(cat ~/.ssh/authorized_keys)" make shell
The above is useful for dockerized applications to supply the authorizeds keys without having to setup volumes.
In another shell, you can log into the BEAM as follows:
ssh -p 22022 localhost
Eshell V7.3 (abort with ^G)
(shelly@Office-iMac)1>