---
title: "Connect to a node"
description: "Open a shell on a node from the console or with ezgh fleets shell, and how sessions reconnect, time out and end."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to a node

A session is a shell on one node as one [OS account](/fleets/accounts). The node must be online.
Which accounts you may use is up to [IAM](/fleets/iam).

> **Caution**
>
> Anyone with a shell on a node can act as the node's [node bot](/fleets/install-the-agent#create-a-node-bot),
> whichever account they use.

### Console

1. Open **Fleets** > **Nodes**, open the node and choose **Connect**. On an EZGH instance's page,
**Connect** > **Session** does the same.
2. Choose the account: **ezgh-user**, or **Another account** such as `root`.
3. The terminal opens in a new browser tab. Closing the tab ends the session.
### CLI

```sh
ezgh fleets shell web-1               # as ezgh-user
ezgh fleets shell web-1 --as root
ezgh fleets shell ins_7k2m9x0a4qpe   # an instance's node
```

The node is its ID, slug (`nod_…`), name, or the instance (`ins_…`) it runs on. Keystrokes go
to the node as you type, Ctrl-C included. To disconnect, press Enter, then `~` and `.`, as with
ssh. Disconnecting ends the session. The exit code is the shell's when it exits, and 0 when you
disconnect.
### API

[StartSession](/fleets-api/StartSession/) with `osUser`
returns the session and a single-use ticket that lasts 30 seconds. The client opens the
session's WebSocket URL with the ticket as a WebSocket subprotocol, never in the URL. The
console and `ezgh` do this for you.

## Reconnects

A session lives on the node, not in your connection. If your connection drops, the console and
`ezgh` reconnect to the same session within a minute and carry on where they left off, with
nothing lost or repeated. Each reconnect checks your access again.

## How a session ends

A session ends when you close its terminal tab or `ezgh fleets shell` (`client_closed`), or for one
of the reasons below. Sessions are live only: once a session ends it's gone from Fleets, and
[Trails](/fleets/trails) has the record of it.

| End reason | When |
| --- | --- |
| `exited` | The shell exited |
| `client_closed` | You closed the terminal or disconnected |
| `idle_timeout` | Nothing was typed (no input) for the project's idle timeout (default 20 minutes). Output doesn't count |
| `max_duration` | The session reached the project's maximum duration (default 8 hours) |
| `terminated` | Someone [terminated](#terminate-a-session) it |
| `revoked` | Your access to the account was removed |
| `keepalive_missed` | Your console tab or `ezgh` stopped checking in for 5 minutes |
| `node_reset` | The node was [reset](/fleets/install-the-agent#the-nodes-binding) |
| `node_deregistered` | The node was deregistered, or its project deleted |
| `node_disconnected` | The node went offline and didn't come back within a minute |
| `client_gone` | Your connection dropped and didn't come back within a minute |
| `osUser_not_found` | The named account doesn't exist on the node |
| `start_failed` | The node couldn't start the shell |
| `resume_gap` | A reconnect couldn't carry on where it left off, so the session was ended rather than lose input or output |
| `gateway_lost` | Fleets lost track of the session's connection and ended it |

While you're connected, the console and `ezgh` check your access every 2 minutes with your own
credentials. When your access is removed, the session ends within a few minutes.

## Terminate a session

To end someone else's live session, find it with `ezgh fleets sessions list`, then run
`ezgh fleets sessions terminate ssn_…` (or call [TerminateSession](/fleets-api/TerminateSession/)).
It needs `fleets.sessions.terminate`, and it ends the shell on the node.

## Settings

A project's Fleets settings (**Fleets** > **Settings**, or
[UpdateSettings](/fleets-api/UpdateSettings/)) apply to every node in it:

| Setting | Default | Range |
| --- | --- | --- |
| Idle timeout | 20 minutes | 5 minutes to 24 hours |
| Maximum duration | 8 hours | 15 minutes to 24 hours |
| `ezgh-user` sudo | Off | On or off. See [`ezgh-user`](/fleets/accounts#ezgh-user) |

## Limits

| Limit | Default |
| --- | --- |
| Concurrent sessions per node | 10 |
| Concurrent sessions per organization | 200 (adjustable in [Service quotas](/quotas)) |

Source: https://docs.ezghcloud.com/fleets/connect/index.mdx
