Skip to content

Linux servers

Enroll one Linux server in Teleport and connect to it from a beam over SSH.

Build with agents
On this page

Run the Teleport SSH Service on a Linux server to make it reachable from a beam. The service connects out to your Teleport cluster. Inside the beam, use tsh ssh with the beam’s delegated identity. SSH does not use VNet.

Linux server access from a beam

The Teleport agent on the Linux server dials out to the Beams cluster proxy. The beam uses tsh ssh to connect over that tunnel.

The Teleport agent on the Linux server dials out to the Teleport Proxy for the Beams cluster and establishes a reverse tunnel. Inside the beam, tsh ssh connects through the proxy over that tunnel to the SSH Service on the server. The beam does not connect directly to the server.

Beams cluster Beams runtime tsh ssh Teleport Proxy
Outbound tunnel
to Beams cluster proxy
SSH connection
via Teleport Proxy
Linux server
Teleport agent SSH Service

Prerequisites

  • A Teleport cluster v18.8.0 or later with Beams enabled. You need permission to create node join tokens, read their registration secrets, manage roles and create beams.
  • A workstation with tctl and tsh, signed in to the cluster.
  • A Linux server you administer, with systemd, an existing non-root login for the beam and outbound connectivity to the Teleport proxy. This example uses the login beam-reader. Use a non-privileged account without sudo and grant it only the OS permissions the task needs.

Enroll the server

Use Bound Keypair Joining to enroll the SSH Service. The server uses a single-use registration secret on its first join. It generates its own keypair and stores the private key and join state in /var/lib/teleport. Keep that directory across restarts and don’t copy it to another server. Create a separate token for each server.

Create a registration secret

On your workstation, save the following as server-join.yaml. Replace YYYY-MM-DDTHH:MM:SSZ with a UTC timestamp shortly in the future. The deadline limits first registration without expiring the token used for recovery.

YAML
kind: token
version: v2
metadata:
  name: example-server-join
spec:
  roles: [Node]
  join_method: bound_keypair
  bound_keypair:
    onboarding:
      must_register_before: "YYYY-MM-DDTHH:MM:SSZ"
    recovery:
      mode: standard
      limit: 1
CLI · Admin workstation
tctl create server-join.yaml

In a private terminal, run tctl get token/example-server-join --with-secrets and securely transfer only the status.bound_keypair.registration_secret value to /root/teleport-node.registration-secret on the server. Make the file readable only by root. Don’t copy the secret into a client beam or commit it to source control.

Configure and start the SSH Service

Install Teleport on the Linux server using the instructions for your cluster and Linux distribution. On a new server, save the following as /etc/teleport.yaml. Replace teleport.example.com:443 with your Teleport proxy address.

YAML
version: v3
teleport:
  nodename: example-server
  data_dir: /var/lib/teleport
  proxy_server: teleport.example.com:443
  join_params:
    token_name: example-server-join
    method: bound_keypair
    bound_keypair:
      registration_secret_path: /root/teleport-node.registration-secret
ssh_service:
  enabled: true
  labels:
    beams-access: example-server
auth_service:
  enabled: false
proxy_service:
  enabled: false
CLI · Linux server
sudo systemctl enable --now teleport

Check for example-server in the Teleport Web UI or run tsh ls from a workstation session that can view it. After it joins, remove registration_secret_path and its now-empty bound_keypair block from join_params, then delete the secret file and any transfer copies. Keep the named token, the bound_keypair join method, and the data directory. The initial join uses the one recovery attempt in this example; see the Bound Keypair guide if the server later needs to rejoin.

Delegate one server and login

Save this role as beam-server-access.yaml. Use the existing non-root account you chose on the server in place of beam-reader if different. Apply the label only to the server you intend to expose to this role.

YAML
kind: role
version: v8
metadata:
  name: beam-server-access
spec:
  allow:
    node_labels:
      beams-access: example-server
    logins: [beam-reader]
CLI · Admin workstation
tctl create beam-server-access.yaml

Assign beam-server-access to your Teleport user through your user or SSO role mapping, then sign in again. Your cluster must allow you to delegate the role.

Connect from a beam

CLI · Local terminal
tsh beams add --roles=beam-server-access --no-share-connected-accounts

Inside the beam, list the servers you can access. Replace example-server with the name from tsh ls and beam-reader with the login you granted. The example runs hostname on the server to verify the connection.

CLI · Inside the beam
tsh ls
tsh ssh beam-reader@example-server hostname

When you’re done, delete the beam. To enroll more servers, see Teleport Server Auto-Discovery.

Search docs

Loading search and AI…

Skills

Install all available skills. All Beams and Teleport skills are hosted in our OSS Teleport repository.

npx skills add https://github.com/gravitational/teleport