tsh CLI reference
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 environment variables
Environment variables configure your tsh client and can help you avoid using flags repetitively.
Environment Variable | Description | Example Value |
---|---|---|
TELEPORT_AUTH | Any defined authentication connector, including passwordless and local (i.e., no authentication connector) | okta |
TELEPORT_CLUSTER | Name of a Teleport root or leaf cluster | cluster.example.com |
TELEPORT_LOGIN | Login name to be used by default on the remote host | root |
TELEPORT_LOGIN_BIND_ADDR | Address in the form of host:port to bind to for login command webhook | host:port |
TELEPORT_LOGIN_BROWSER | Set to none to stop the system default browser from opening for SSO logins. If the value is not none , tsh will open the system default browser. | none |
TELEPORT_PROXY | Address of the Teleport proxy server | cluster.example.com:3080 |
TELEPORT_RELAY | Address of the Teleport relay server to use, "none" to disable the use of a relay, or "default" to use the default address specified by the control plane at login time. Defaults to port 443. | relay.example.com |
TELEPORT_HEADLESS | Use headless authentication | true, false, 1, 0 |
TELEPORT_HOME | Home location for tsh configuration and data | /directory |
TELEPORT_USER | A Teleport user name | alice |
TELEPORT_ADD_KEYS_TO_AGENT | Specifies if the user certificate should be stored on the running SSH agent | yes, no, auto, only |
TELEPORT_USE_LOCAL_SSH_AGENT | Disable or enable local SSH agent integration | true, false |
TELEPORT_GLOBAL_TSH_CONFIG | Override location of global tsh config file from default /etc/tsh.yaml | /opt/teleport/tsh.yaml |
TELEPORT_MFA_MODE | Preferred mode for MFA and Passwordless assertions | auto, cross-platform, platform, otp, sso |
TELEPORT_IDENTITY_FILE | File path to identity file | /opt/identity |
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 |
--relay | none | `host[:port] | none |
--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 | standard | standard or oldssh | SSH certificate format. oldssh supports older versions of OpenSSH servers that do not allow for custom metadata, which is how Teleport encodes a user's roles in their SSH certificate. |
--insecure | none | none | Do not verify the server's certificate and host name. Use only in test environments. |
--auth | local | Any defined authentication connector, including passwordless and local (i.e., no authentication connector) | Specify the type of authentication connector to use. |
--mfa-mode | auto | auto , cross-platform , platform , otp , or sso | 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 |
--headless | none | none | Use Headless Authentication |
--mlock | auto | auto , off , best_effort , strict | Lock process memory to protect client secrets stored in memory from being swapped to disk. |
tsh apps ls
List all available applications:
tsh apps ls
tsh clusters
tsh clusters [<flags>]
Flags
Name | Default Value(s) | Allowed Value(s) | Description |
---|---|---|---|
-q, --quiet | none | none | no headers in output |
Global flags
These flags are available for all commands --login
, --proxy
, --relay
, --user
, --ttl
, --identity
, --cert-format
, --insecure
, --auth
, --skip-version-check
, --debug
, --jumphost
.
Run tsh help <subcommand>
or see the Global Flags section.
Examples
tsh clustersCluster Name Status
------------ ------
staging online
production offline
tsh clusters --quietstaging online
production offline
tsh config
Print OpenSSH configuration details to allow using an SSH client with credentials managed by Teleport to connect to hosts in your cluster.
tsh config
Flags
Name | Default Value(s) | Allowed Value(s) | Description |
---|---|---|---|
-l, --login | none | Linux username | Default Linux username to use. Will translate to SSH config's User option. |
-p , --port | 3022 | port | Default SSH port to use. Will translate to SSH config's Port option. |
Examples
Print OpenSSH config file to console
tsh configAppend Teleport configuration to ssh config
tsh config >> ~/.ssh/config
tsh device enroll
Enroll the current device as a trusted device.
Requires a device enrollment token created via tctl devices enroll
.
tsh device enroll --token=TOKEN
Flags
Name | Default Value(s) | Allowed Value(s) | Description |
---|---|---|---|
--token | none | String | Device enrollment token |
Examples
tsh device enroll --token=AAAAAAAAAAAAAAAAAAAAAAAA-this-is-an-exampleDevice "C00AA0AAAA0A"/macOS enrolled