--- title: Teleport CLI Reference description: Detailed guide and reference documentation for Teleport's command line interface (CLI) tools. h1: Command Line (CLI) Reference --- Teleport is made up of three CLI tools. - [teleport](#teleport): The daemon that runs the Auth Service, Proxy Service, and other Teleport services. - [tsh](#tsh): A tool that lets end users interact with Teleport. - [tctl](#tctl): An administrative tool that can configure the Teleport Auth Service. (!docs/pages/includes/permission-warning.mdx!) (!docs/pages/includes/backup-warning.mdx!) ## teleport The Teleport daemon is called `teleport`. It can be configured to run one or more "roles" with the `--roles` flags. The arguments to `--roles` correspond to the following services. Teleport Cloud manages Teleport instances with the `auth` and `proxy` roles. Use the remaining roles to manage access to specific resources and other Teleport clusters. | Service | Role Name | Description | | - | - | - | | [Node](../architecture/nodes.mdx) | `node` | Runs a daemon on a host that allows SSH connections from authenticated clients. | | [Auth](../architecture/authentication.mdx) | `auth` | Authenticates hosts and users who want access to Teleport-managed resources or information about a cluster. | | [Proxy](../architecture/proxy.mdx) | `proxy` | The gateway that clients use to connect to the Auth Service or resources managed by Teleport. | | [App](../application-access/introduction.mdx) | `app` | Runs a daemon on a host that provides access to applications using an SSH reverse tunnel. | | [Kube](../kubernetes-access/introduction.mdx) | `kube` | The Teleport daemon will run the Kubernetes Service. | | [DB](../database-access/reference.mdx) | `db` | The Teleport daemon will run the Database Service. | | [Trusted Cluster](../management/admin/trustedclusters.mdx) | `trusted_cluster` | The Teleport daemon will support a leaf cluster used to connect to another Teleport cluster. | | [Windows Desktop](../desktop-access/getting-started.mdx) | `windowsdesktop` | The Teleport daemon will run the Windows Desktop Service. | ### teleport start #### Flags | Name | Default Value(s) | Allowed Value(s) | Description | | - | - | - | - | | `-d, --debug` | none | none | enable verbose logging to stderr | | `--insecure-no-tls` | `false` | `true` or `false` | Tells proxy to not generate default self-signed TLS certificates. This is useful when running Teleport on kubernetes (behind reverse proxy) or behind things like AWS ELBs, GCP LBs or Azure Load Balancers where SSL termination is provided externally. | | `-r, --roles` | `proxy,node,auth` | **string** comma-separated list of `proxy, auth, node, db, app` or `windowsdesktop` | start listed services/roles. These roles are explained in the [Teleport Architecture](../architecture/overview.mdx) document. | | `--pid-file` | none | **string** filepath | create a PID file at the path | | `--advertise-ip` | none | **string** IP | advertise IP to clients, often used behind NAT | | `-l, --listen-ip` | `0.0.0.0` | [**net. IP**](https://golang.org/pkg/net/#IP) | binds services to IP | | `--auth-server` | none | **string** IP | proxy attempts to connect to a specified auth server instead of local auth, disables `--roles=auth` if set | | `--token` | none | **string** | set invitation token to register with an auth server on start, used once and ignored afterwards. Obtain it by running `tctl nodes add` on the auth server.*We recommend to use tools like `pwgen` to generate sufficiently random tokens of 32+ byte length.* | | `--ca-pin` | none | **string** `sha256:` | set CA pin to validate the Auth Server. Generated by `tctl status` | | `--nodename` | value returned by the `hostname` command on the machine | **string** | assigns an alternative name for the node which can be used by clients to log in. | | `-c, --config` | `/etc/teleport.yaml` | **string** `.yaml` filepath | starts services with config specified in the YAML file, overrides CLI flags if set | | `--bootstrap` | none | **string** `.yaml` filepath | bootstrap configured YAML resources {/* TODO link how to configure this file */} | | `--labels` | none | **string** comma-separated list | assigns a set of labels to a node, for example env=dev,app=web. See the explanation of labeling mechanism in the [Labeling Nodes](../management/admin/labels.mdx) section. | | `--insecure` | none | none | disable certificate validation on Proxy Service, validation still occurs on Auth Service. | | `--fips` | none | none | start Teleport in FedRAMP/FIPS 140-2 mode. | | `--skip-version-check` | `false` | `true` or `false` | Skips version checks between the Auth Server this Teleport instance | | `--diag-addr` | none | none | Enable diagnostic endpoints | | `--permit-user-env` | none | none | flag reads in environment variables from `~/.tsh/environment` when creating a session. | | `--app-name` | none | none | Name of the application to start | | `--app-uri` | none | none | Internal address of the application to proxy | | `--app-public-addr` | none | none | Public address fo the application to proxy | #### Examples ``` # By default without any configuration, teleport starts running as a single-node # cluster. It's the equivalent of running with --roles=node,proxy,auth sudo teleport start # Starts a node named 'db' running in strictly SSH mode role, joining the cluster # serviced by the auth server running on 10.1.0.1 sudo teleport start --roles=node --auth-server=10.1.0.1 --token=xyz --nodename=db # Same as the above, but the node runs with db=master label and can be connected # to using that label in addition to its name. sudo teleport start --roles=node --auth-server=10.1.0.1 --labels=db=master # Starts an app server that proxies the application "example-app" running at http://localhost:8080. sudo teleport start --roles=app --token=xyz --auth-server=proxy.example.com:3080 \ --app-name="example-app" \ --app-uri="http://localhost:8080" \ --labels=group=dev ``` ### teleport status Shows the status of a Teleport connection: ```code $ teleport status ``` This command is only available from inside of a recorded SSH session. ### teleport configure Dumps a **sample** configuration file in YAML format into standard output: ```code $ teleport configure ``` **Caution**: This sample config is *not* the default config and should be used for reference only. View [Config Reference](./config.mdx) for all YAML configuration options. ### teleport version Shows the release version: ```code $ teleport version ``` ### teleport help Displays help options for `teleport`: ```code $ teleport help ``` And, for its subcommands: ```code $ teleport help ``` ## tsh `tsh` is a CLI client used by Teleport Users. It allows users to interact with current and past sessions on the cluster, copy files to and from nodes, and list information about the cluster. ### tsh global flags | Name | Default Value(s) | Allowed Value(s) | Description | | - | - | - | - | | `-l, --login` | none | an identity name | The login identity that the Teleport user will use | | `--proxy` | none | `host:https_port[,ssh_proxy_port]` | Teleport Proxy Service address | | `--user` | `$USER` | none | The Teleport username | | `--ttl` | `720` (12 hours) | integer | Number of minutes a certificate issued for the `tsh` user will be valid for | | `-i, --identity` | none | **string** filepath | Identity file | | `--cert-format` | `file` | `file` or `openssh` | SSH certificate format | | `--insecure` | none | none | Do not verify the server's certificate and host name. Use only in test environments. | | `--auth` | `local` | any defined [authentication connector](./authentication.mdx), including `local` and `passwordless` | Specify the type of authentication connector to use. | | `--mfa-mode` | auto | `auto`, `cross-platform`, `platform` or `otp` | Preferred mode for MFA and Passwordless assertions. | | `--skip-version-check` | none | none | Skip version checking between server and client. | | `-d, --debug` | none | none | Verbose logging to stdout | | `-J, --jumphost` | none | A jump host | SSH jumphost | ### tsh help Prints help: ```code $ tsh help ``` ### tsh version Print the version of your `tsh` binary: ```code $ tsh version ``` ### tsh ssh Run shell or execute a command on a remote SSH node: ```code $ tsh ssh [] <[user@]host> [...] ``` #### Arguments `<[user@]host> [...]` - `user` The login identity to use on the remote host. If `[user]` is not specified the user defaults to `$USER` or can be set with `--user`. If the flag `--user` and positional argument `[user]` are specified the arg `[user]` takes precedence. - `host` The `nodename` of a cluster Node or a label specification like `env=aws` to run on all matching hosts. - `command` The command to execute on a remote host. #### Flags | Name | Default Value(s) | Allowed Value(s) | Description | | - | - | - | - | | `-p, --port` | none | port | SSH port on a remote host | | `-A, --forward-agent` | none | none | Forward agent to target node like `ssh -A` | | `-L, --forward` | none | none | Forward localhost connections to remote server | | `-D, --dynamic-forward` | none | none | Forward localhost connections to remote server using SOCKS5 | | `-N, -no-remote-exec` | none | none | Don't execute remote command, useful for port forwarding | | `--local` | none | | Execute command on localhost after connecting to SSH node | | `-t, --tty` | `file` | | Allocate TTY | | `--cluster` | none | | Specify the cluster to connect | | `-o, --option` | `local` | | OpenSSH options in the format used in the configuration file | | `--enable-escape-sequences` | | | Enable support for SSH escape sequences. Type `~?` during an SSH session to list supported sequences. | | `--no-use-local-ssh-agent` | | | Do not load generated SSH certificates into the local ssh-agent (specified via `$SSH_AUTH_SOCK`). Useful when using `gpg-agent` or Yubikeys. You can also set the `TELEPORT_USE_LOCAL_SSH_AGENT` environment variable to `false` (default `true`) | | `-X, --x11-untrusted` | none | none | Requests untrusted (secure) X11 forwarding for this session. | | `-Y, --x11-trusted` | none | none | Requests trusted (insecure) X11 forwarding for this session. This can make your local machine vulnerable to attacks, use with caution. | | `--x11-untrusted-timeout` | 10m | duration | Sets a timeout for untrusted X11 forwarding, after which the client will reject any forwarding requests from the server. | #### Global flags These flags are available for all commands `--login, --proxy, --user, --ttl, --identity, --cert-format, --insecure, --auth, --skip-version-check, --debug, --jumphost`. Run `tsh help ` or see the [Global Flags section](#tsh-global-flags). #### Examples ```code # Log in to node `grav-00` as OS User `root` with Teleport User `teleport` $ tsh ssh --proxy proxy.example.com --user teleport -d root@grav-00 # `tsh ssh` takes the same arguments as OpenSSH client: $ tsh ssh -o ForwardAgent=yes root@grav-00 $ tsh ssh -o AddKeysToAgent=yes root@grav-00 # Run `hostname` on all nodes with the `env: aws` label $ tsh ssh root@env=aws hostname ``` ### tsh config Generates OpenSSH configuration to use currently logged in teleport as a bastion host. ```code $ tsh config ``` #### Examples ```code # Print OpenSSH config file to console $ tsh config # Append Teleport configuration to ssh config $ tsh config >> ~/.ssh/config ``` ### tsh apps ls List all available applications: ```code $ tsh apps ls ``` ### tsh join Joins an active session: ```code $ tsh join [] ``` #### Arguments `` - `session-id` The UUID of an active Teleport Session obtained by `teleport status` within the session. #### Flags | Name | Default Value(s) | Allowed Value(s) | Description | | - | - | - | - | | `--cluster` | none | a cluster_name | Specify the cluster to connect | #### Global flags These flags are available for all commands `--login, --proxy, --user, --ttl, --identity, --cert-format, --insecure, --auth, --skip-version-check, --debug, --jumphost`. Run `tsh help ` or see the [Global Flags section](#tsh-global-flags). #### Examples ```code # join session using teleport user joe as ec2-user $ tsh --user=joe --login=ec2-user join ``` ### tsh play Plays back a prior session: ```code $ tsh play [] ``` #### Arguments `` - `session-id` The UUID of a past Teleport Session obtained by `teleport status` within the session or from the Web UI. #### Flags | Name | Default Value(s) | Allowed Value(s) | Description | | - | - | - | - | | `--cluster` | none | a cluster_name | Specify the cluster to connect | | `--format` | `pty` | json, pty | Format for playback | #### Global flags These flags are available for all commands `--login, --proxy, --user, --ttl, --identity, --cert-format, --insecure, --auth, --skip-version-check, --debug, --jumphost, --format`. Run `tsh help ` or see the [Global Flags section](#tsh-global-flags). #### Examples ```code $ tsh --proxy proxy.example.com play # Playing back a session using pty format using a downloaded session recording. $ tsh play --format=pty 1fe153d1-ce8b-4ef4-9908-6539457ba4ad.tar # Playing back a session in json format using jq to filter on events $ tsh play --format=json ~/play/0c0b81ed-91a9-4a2a-8d7c-7495891a6ca0.tar | jq '.event ``` ### tsh proxy app Starts a local TLS proxy for Application Access connections. You can use this proxy to connect to an application repeatedly after a single login to your Teleport cluster, which is especially useful for interacting with an application via a CLI. ```code $ tsh proxy app [] ``` #### Arguments `` - `app` The name of the application to start the local proxy for. To see a list of available applications, run `tsh apps ls`. #### Flags | Name | Default Value(s) | Allowed Value(s) | Description | | - | - | - | - | | `--port` | none | port number | Specify the source port for the local proxy | #### [Global Flags](#tsh-global-flags) These flags are available for all commands `--login, --proxy, --user, --ttl, --identity, --cert-format, --insecure, --auth, --skip-version-check, --debug, --jumphost, --format`. Run `tsh help ` or see the [Global Flags Section](#tsh-global-flags) #### Examples ```code $ tsh proxy app # Proxy a connection to grafana on local port 10700 $ tsh proxy --port 10700 app grafana & # Proxying connections to grafana on 127.0.0.1:10700 $ curl http://127.0.0.1:10700/api/users ``` ### tsh scp Copies files from source to dest: ```code $ tsh scp [] ... ``` {/* TODO Confirm which flags are supported and whether supports multiple sources */} #### Arguments - `` - filepath to copy - `` - target destination #### Flags | Name | Default Value(s) | Allowed Value(s) | Description | | - | - | - | - | | `--cluster` | none | a cluster_name | Specify the cluster to connect | | `-r, --recursive` | none | none | Recursive copy of subdirectories | | `-P, --port` | none | port number | Port to connect to on the remote host | | `-q, --quiet` | none | none | Quiet mode | #### Global flags These flags are available for all commands `--login, --proxy, --user, --ttl, --identity, --cert-format, --insecure, --auth, --skip-version, --debug, --jumphost`. Run `tsh help ` or see the [Global Flags section](#tsh-global-flags). #### Examples ```code $ tsh --proxy=proxy.example.com scp -P example.txt user@host:/destination/dir ``` ### tsh ls List cluster nodes: ```code $ tsh ls [] [