---
name: "ssh_sshd"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:12.b.3-1"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/ssh_sshd"
---

# ssh\_sshd(3erl)

SSH server with erlang shell.

## NAME

ssh\_sshd - SSH server with erlang shell.

## DESCRIPTION

This module implements an erlang shell as an SSH server.

## EXPORTS

**listen(Port) -\> {ok, Pid}\|{error, Error}**\
 **listen(Port, Options) -\> {ok, Pid}\|{error, Error}**\
 **listen(Addr, Port, Options) -\> {ok, Pid}\|{error, Error}**\

- Types

  Addr = string()\
   Port = integer()\
   Options = \[{Option, Value}\]\

Create a listener on the given port. (It calls *ssh\_cli:listen* with *shell:start/0* as argument.) An SSH client can be used to connect to the listener and execute erlang commands.

Unix example:

```
1> ssh_sshd:listen(9999, [{system_dir, "."}])
<0.59.0>
```

On a unix shell:

```
bash@balin$ ssh -p 9999 balin
Eshell V5.4.9.1  (abort with ^G)
1> exit().
Connection to balin closed.
bash@balin$
```

This assumes that the current dir contains a private host key.

For options, see *ssh\_cli:listen/3* and *ssh\_cm:listen/4*.

**stop(Pid) -\> ok \| {error, Reason}**\

- Types

  Pid = pid()\
   Reason = atom()\

Stops the listener given by *Pid*.
