---
name: "ssh_cli"
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_cli"
---

# ssh\_cli(3erl)

SSH Command Line Interface.

## NAME

ssh\_cli - SSH Command Line Interface.

## DESCRIPTION

This module implements a CLI (Command Line Interface), for an SSH server. It's used by *ssh\_sshd* to provide an interactive erlang shell as an ssh server.

Since *ssh\_cli* uses the *group* module, the CLI provides full editing just like in the erlang shell, with history (ctrl-p and ctrl-n), line editing and configurable tab expansion (completion).

A full example of how to use *ssh\_cli* is provided in *ssh/examples/ssh\_sample\_cli.erl*.

## EXPORTS

**listen(Shell)**\
 **listen(Shell, Port)**\
 **listen(Shell, Port, Options)**\
 **listen(Shell, Addr, Port, Options)**\

- Types

  Shell = pid() \| fun()\
   Port = integer()\
   Addr = string()\
   Options = \[{Option, Value}\]\
   Option = atom()\
   Value = term()\

Starts a daemon listening on *Port*. The *Shell* fun is a function spawning a shell process, containing a read-eval-print-loop using ordinary erlang *io* (e.g. *get\_line/1* and *fprint*).

The daemon's group leader will be connected to the SSH daemon, so that the io will be sent to the remote SSH shell client.

An example of how *ssh\_cli* can be used can be found in *ssh/examples/ssh\_cli\_sample.erl*.

The module *ssh\_sshd* is implemented using *ssh\_cli*.

For options, see *ssh\_cm:listen*.

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

- Types

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

Stops the listener given by *Pid*, existing connections will stay open.
