> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/s/secure-shell-ssh.md).

# Secure Shell (SSH)

The Secure Shell adapter logs in to Linux hosts over SSH and runs read-only commands to collect hardware, operating system, network and, optionally, software and service data. Each reachable host becomes one device. All targets share one credential.

## Use cases

* List Linux hosts collected over SSH.

```
Adapters = secure-shell
```

* Find scanned hosts that no EDR covers.

```
Adapters = secure-shell AND NOT Adapters = falcon-crowdstrike
```

## Before you begin

### Network

| Source              | Destination                                      | Port                       | Protocol |
| ------------------- | ------------------------------------------------ | -------------------------- | -------- |
| OctoXLabs connector | Each target host (CIDR, range or list you enter) | 22 (default, configurable) | SSH      |

### Required permissions

| Scope or role           | Permission   | Needed for                                                          |
| ----------------------- | ------------ | ------------------------------------------------------------------- |
| Non-root SSH user       | Run commands | Most fields (host name, OS release, kernel, network, memory, disks) |
| sudo (with Use Sudo on) | `sudo -n`    | Privileged details such as the system serial number                 |

Targets must be reachable over SSH and accept one shared credential (password or key). The collector runs: hostname, cat /etc/machine-id, cat /etc/os-release, uname, DMI files under /sys/class/dmi/id, systemd-detect-virt, ip -j addr, nproc, /proc/meminfo, lsblk, uptime -s. With Fetch Software: dpkg-query, rpm or apk. With Fetch Services: systemctl list-units.

## Create credentials in Secure Shell (SSH)

{% stepper %}
{% step %}

### Pick a user

Choose an SSH user that can log in to every target. A non-root user works for most fields.
{% endstep %}

{% step %}

### Choose password or key

Use a password, or a PEM private key (with a passphrase if the key is encrypted). One of the two is required.
{% endstep %}

{% step %}

### Optional sudo

If you need privileged fields, allow the user to run `sudo -n` without a prompt and turn on Use Sudo.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter                  | Required    | Type    | Default | Description                                                                                                        |
| -------------------------- | ----------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------ |
| Targets                    | Yes         | String  | None    | CIDR (192.168.1.0/24), dashed range (192.168.1.10-50), or a comma or newline separated list of IPs and host names. |
| Port                       | No          | Integer | 22      | SSH port.                                                                                                          |
| Username                   | Yes         | String  | None    | SSH user for every target.                                                                                         |
| Password                   | Conditional | String  | None    | Password. Leave empty when you use a private key.                                                                  |
| Private Key                | Conditional | String  | None    | PEM private key. Either a password or a private key is required.                                                   |
| Passphrase                 | No          | String  | None    | Passphrase of an encrypted private key.                                                                            |
| Use Sudo (Advanced)        | No          | Boolean | False   | Run commands with `sudo -n`.                                                                                       |
| Connect Timeout (Advanced) | No          | Integer | 10      | Seconds to wait for connect and authentication per host. Unreachable hosts are skipped.                            |
| Command Timeout (Advanced) | No          | Integer | 30      | Seconds to wait for the collection command per host.                                                               |
| Thread Count (Advanced)    | No          | Integer | 32      | Hosts scanned in parallel. Min 1, max 32.                                                                          |
| Max Targets (Advanced)     | No          | Integer | 4096    | Maximum hosts one connection may expand to. Larger ranges are rejected.                                            |
| Fetch Software (Advanced)  | No          | Boolean | False   | Collect installed packages (dpkg, rpm or apk).                                                                     |
| Fetch Services (Advanced)  | No          | Boolean | False   | Collect running systemd services.                                                                                  |

## Troubleshooting

| Error message                                                                 | Cause                                                                                                                                      | Fix                                                                                                                          |
| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| Either password or private\_key must be provided.                             | Neither Password nor Private Key is set.                                                                                                   | Fill one of them.                                                                                                            |
| Could not parse the provided private key:                                     | The key text is not a valid PEM key, or the passphrase is wrong.                                                                           | Paste the full PEM key and check the passphrase.                                                                             |
| Target list exceeds the maximum of hosts.                                     | Targets expands to more hosts than Max Targets.                                                                                            | Narrow the range or raise Max Targets.                                                                                       |
| SSH connection test failed for every reachable target within the time budget. | No target accepted the login and returned output within 25 seconds.                                                                        | Check reachability, port, credential and the `id` command.                                                                   |
| Status Code:                                                                  | The API answered with a status other than the one the connector expects. The message also lists the URL, the method and the response body. | Read the status code and the response body in the message, then check the credentials, the permissions and the network path. |

## Change history
