Running the OpenTelemetry Collector with least privilege: when root is needed
Most Collector receivers and exporters do not need root. Host metrics and node log collection are the exceptions, because they read host state or files that normal service accounts cannot see. A platform or security team asked to justify the Collector's privileges should start by listing each pipeline and asking which of its receivers actually touch the host, then grant elevated access only to those. The default assumption should be a non-root process, with extra access added one receiver at a time.
The OpenTelemetry Collector is a vendor-agnostic way to receive, process and export telemetry such as traces, metrics and logs. It can run as an agent next to services on each host, or as a gateway that accepts data from many sources in one place. That split matters for privilege: an agent is the deployment most likely to need host access, while a gateway usually receives data over the network and forwards it onward. The Collector is not an observability backend. Storage and visualization are handled by separate tools, so the privileges needed for those systems are a separate review and should not be folded into the Collector's justification.
Before approving a deployment, confirm which receivers, processors and exporters are in each configuration file, which of them read host paths or host APIs, and which run as which user in your environment. The Collector configuration docs describe the component model you will need to map against. Treat the answers as the input to the privilege decision, not as an assumption carried over from a sample configuration.
Privilege options by receiver and deployment pattern
This table compares three run-as patterns for the Collector: a non-root user with no host mounts, a non-root user with scoped read access to host paths or log files, and a privileged or root agent for host-level collection. Read each row against the receivers you plan to enable, since the privilege a receiver needs depends on what it reads. The main takeaway is that most receivers can run unprivileged, and host access should be granted only to the specific receivers that require it.
| Pattern | Typical receivers | Privilege needed | Main risk | When it fits |
|---|---|---|---|---|
| Non-root, no host mounts | OTLP receivers, Prometheus scraping of remote endpoints, most application-facing receivers | Network access to listen on the configured port, no host filesystem or process access | Exposed listener on a wide interface if the bind address is not restricted | Gateways and services that only receive telemetry over the network |
| Non-root with scoped host read access | Filelog receiver reading container or application log files, journald-style log reads where supported | Group membership or read-only mounts on specific log directories, confirm exact paths in the receiver README | Broad group grants that expose unrelated files, or write access left on mounts by mistake | Node agents that must read logs but do not need host process or kernel data |
| Privileged or root agent | Host metrics receiver and any receiver that reads host process, network or device data | Root or elevated capabilities and host namespace access, confirm the exact capabilities each receiver needs in its docs | A compromised Collector gains broad host visibility and possibly control of the node | Dedicated host metrics agents where the data cannot be collected any other way |
| Mixed deployment, split by role | Host metrics on one agent, log collection on another, OTLP on a gateway | Each role gets only the privilege its receivers need | More workloads to configure, patch and monitor | Teams that want the privileged agent kept small and separate from network-facing gateways |
How to set up non-root Collector execution step by step
This sequence takes a Collector configuration that currently runs with broad access and turns it into a deployment where each receiver has a known binding, each host path has a named read permission, and the process runs as a dedicated non-root user. Each step ends with a check so the team can confirm the change before moving on.
Inventory receivers and their listening addresses
The platform or observability engineer reads the Collector configuration file and lists every receiver, extension and exporter, noting the endpoint or address each one uses. Include receivers that are only referenced in a pipeline and any extension that exposes a local HTTP port, such as health checks or zPages. Confirm the list against the running configuration with the Collector's configuration validation before going further, so that nothing is missed when permissions are narrowed later.
Classify each receiver by what it reads
For each item in the inventory, decide whether it only accepts network traffic (for example OTLP from applications) or whether it reads host or container data from the filesystem, such as the host metrics receiver, file log collection or Kubernetes node logs. Mark the host-reading items as the only ones that need elevated access. The output is a short table with one row per component, its classification and the exact paths or APIs it needs. Review the table with the owner of the host so that no path is granted by assumption.
Create a dedicated unprivileged service account
The operations engineer creates a system user and group used only for the Collector, with no login shell and no membership in administrative groups. Do this on the host or, for containers, set a non-zero user ID in the pod or container specification. Confirm the account exists and has no sudo rights by checking its group memberships and the sudoers configuration. Record the user and group IDs so that file permissions and container settings refer to the same identity.
Grant read access to only the paths needed
For each host-reading receiver, the engineer adds read permission for the specific log files or directories identified in step two, typically through group membership or access control lists. Avoid granting access to whole filesystems,
/var/logas a blanket rule, or any write permission. Where a host metric source requires a path such as the proc or sys filesystem, check the component's documentation for its exact requirements. Confirm the result by running a read test as the Collector user against each granted path and a denied test against a path outside the grant.Bind receivers to the intended interfaces
The engineer sets each receiver's endpoint explicitly in the configuration, using a specific interface address for agents that must accept traffic from other hosts and a loopback address where only local processes send data. Since Collector v0.110.0, server components bind to localhost by default rather than 0.0.0.0, so any receiver that previously relied on the all-interfaces binding will stop accepting remote traffic after upgrade. Confirm the bindings with a socket listing on the host, and confirm that no zPages, pprof or internal metrics port is listening on a public interface.
Run the process without privilege escalation
The engineer starts the Collector under the dedicated account and disables privilege escalation. For systemd, this means setting the service user and group and reviewing any capability settings, with no capabilities added unless a receiver documents a need for one. For Kubernetes, the pod specification sets a non-root user, disallows privilege escalation, drops all capabilities and uses a read-only root filesystem where the image allows it. Confirm the running process user with a process listing, and confirm the container security context with the cluster's configuration output.
Validate that data still flows and denials are clear
The engineer sends test telemetry through each receiver and confirms it reaches the exporter and the back end, checking the Collector's own logs and internal metrics for accepted and refused data. Then the engineer temporarily removes one path grant and confirms that the Collector logs a permission error that names the path and the component, rather than failing silently. Restore the grant, record the final configuration and permissions, and keep the test steps so that they can be repeated after each Collector upgrade.
Least privilege differences across VMs, containers and Kubernetes
On a virtual machine or bare-metal host, the Collector runs as an operating system service. The platform team controls the service definition, the account it runs under and the file permissions on its configuration and data directories. Host metrics collection and reading system logs are the usual reasons the service needs more than an ordinary account, so the goal is to grant those specific read rights to a dedicated user rather than to root. Plan the account and its groups before the first deployment so that the rights are documented in the same change that installs the service.
- Dedicated service user: Create a system account with no login shell, owned only by the Collector process, and run the service under it.
- Scoped group membership: Add the account to the groups that own the specific log files or proc entries it must read, instead of granting broader file modes.
- Restricted configuration: Make the configuration file readable by the service user and writable only by the administrators who deploy it.
- Capabilities over root: Where the host and distribution support it, grant narrow Linux capabilities to the service unit instead of running it as root.
- Separate output paths: Give the buffer and temporary directories their own locations owned by the service user.
Confirm with the host owner which log paths and host metrics sources are approved, who holds sudo or root on the host, and whether the service manager allows capability settings in their hardening policy.
When the Collector runs in a container runtime, the image and the run arguments decide most of its permissions. The platform team usually owns the image build and the run configuration, while the container host owner controls the runtime, the mount points and the kernel features exposed to containers. A non-root user inside the image limits what a compromised process can do, but only if the mounts and capabilities passed at run time do not undo that choice. Treat each host path or socket mounted into the container as an explicit exception that needs a named owner and a reason.
- Non-root user in the image: Set a numeric, non-root user in the image so the process never starts as root.
- Read-only root filesystem: Run with a read-only root filesystem and write only to a named, writable volume for buffers.
- Read-only host mounts: Mount log directories or host files as read-only, and only the paths the pipeline actually reads.
- Dropped capabilities: Drop all capabilities by default and add back only what a named receiver needs.
- No privileged mode: Avoid privileged containers and host namespaces unless a specific receiver cannot work without them.
Confirm with the container host owner which runtime security profile applies, whether the host allows the mounts you need, and who approves any exception that mounts the runtime socket or host namespaces.
In Kubernetes, the Collector is usually deployed as a DaemonSet when it must read node-level data such as container logs or host metrics, and as a Deployment when it acts as a gateway. The platform team can set the pod and container security context, the service account and the RBAC role bound to it. The cluster owner usually controls admission policy, pod security standards and whether host path volumes are allowed in a namespace. Each host-level permission in a DaemonSet widens the blast radius to every node, so review those settings separately from gateway workloads.
- Security context: Set
runAsNonRoot, a fixedrunAsUser,allowPrivilegeEscalation: falseand a read-only root filesystem where the receivers allow it. - Service account scope: Create a dedicated service account for each workload and bind only the RBAC rules needed for discovery, such as reading pods or nodes, rather than cluster-admin.
- Host path limits: Mount only the specific host directories a DaemonSet needs, read-only, and keep them out of gateway Deployments entirely.
- Separate workloads: Keep node-level agents and central gateways in different service accounts and namespaces so their permissions do not overlap.
- Admission enforcement: Use the cluster's pod security controls to block privileged pods, host namespaces and unapproved host paths.
Confirm with the cluster owner which pod security level applies to the namespace, which host paths are approved for DaemonSets, and who reviews RBAC changes for the Collector service accounts.
Security and operational risks of over-privileged Collectors
An over-privileged Collector turns a telemetry agent into a path to host files, secrets and network services. The risks below share one root cause: permissions granted for a convenient first install and never reviewed. Each card names the control to apply and the check that confirms it is still in place.
Host path exposure through mounted volumes
Host metrics and file log collection often need read access to paths such as /proc, /sys or /var/log. Mounting broader host paths than the receivers read lets a compromised Collector browse files it never needed. Mount only the specific paths each receiver uses, mark them read-only, and confirm in the container spec and on the host that nothing else such as /, /etc or a container runtime socket is mounted.
Secrets read from logs and files
A file log receiver with a wide include pattern can ingest credentials written into application logs, environment dumps or configuration files that sit beside log output. Narrow the include globs to the log directories you own and exclude paths that hold secrets. Then test with a sample file containing a dummy token to confirm the token never reaches your exporter output, which is the check a redaction review will ask for.
Kubernetes service account over-permission
Collectors that read pods, nodes or events for metadata need cluster roles, and teams often bind broad rights such as * on all resources. Grant only the get, list and watch verbs on the resources your receivers and processors query, bind them to the namespace where possible, and disable automatic token mounting for workloads that do not call the API. Verify with a permission check for the Collector's service account before and after each change.
Receivers exposed on public interfaces
A receiver that listens on all interfaces accepts telemetry, and sometimes control traffic, from networks that should never reach it. Since Collector v0.110.0, server components bind to localhost by default, so an explicit change is needed to widen exposure. Review each receiver's endpoint value, bind agents to the node or pod address they need, and confirm with a port scan from outside the trusted network that only intended ports answer.
Non-root runtime and writable paths
Running the Collector as root gives any exploit full control of the host, even when the pipeline only needs to read a few files. Set a non-root user and group in the pod or service unit, drop Linux capabilities that the receivers do not use, and make the root filesystem read-only where your deployment allows. Confirm the running process user with a process listing, and check that only the storage path for the file storage extension is writable.
Permission drift after upgrades
A new Collector release can rename components, change defaults or require a file or socket path that the old permissions did not cover, causing silent data loss or a crash loop. Record the minimal permission set with each release tag, test the upgraded image in staging against the same mounts and roles, and read the release notes for component changes before rollout. Re-run the permission and port checks after every upgrade, since drift shows up there first.
Collector release notesHow agents, gateways and host access fit together
The diagram starts with applications sending OTLP traces, metrics and logs to a node-level agent. The agent also reads host logs and host metrics, which is the only place that needs host-level access, and it runs with scoped read permissions rather than full root. The agent forwards data to a gateway, which handles authentication, processing and export to the back end. Check each boundary: what crosses from the node into the cluster, and which identities and ports the gateway trusts.
Data paths through node agents and a gateway, with host access limited to the agent.
Questions teams ask before running the Collector without root
What drives the effort to move the Collector off root?
The effort depends on which receivers and processors need host-level access and how many deployments run them. Collectors that only receive OTLP over the network and export it usually run without elevated rights with little change. Host metrics, node log collection and file-based receivers need read access to paths such as /var/log or /proc, and some need capabilities or group membership. Each host-access requirement adds a permission to define, test and document. Count the number of distinct Collector deployments, their receivers and the file paths or kernel interfaces each one reads. That inventory sets most of the work.
Can our in-house team do this without outside help?
Yes, if your team already runs the Collector, understands Linux users, file permissions and container security contexts, and can test changes outside production. The work is mostly configuration and verification, not new code. Teams usually struggle where ownership is unclear, for example when a host access request crosses platform, security and application groups, or when nobody owns the test environment. A partner is more useful when the inventory is large, the deployments span Kubernetes and virtual machines, or the team lacks time to repeat tests after each upgrade. Ask any provider to scope the work in writing before it starts.
What does the work need from our team?
Three inputs matter most. First, an inventory of every Collector deployment, its receivers, processors, exporters and the host paths or kernel interfaces each one reads. Second, named owners for each host-access request, who can confirm why access is needed and approve its scope. Third, test environments that match production operating systems, container runtimes and log layouts closely enough that permission failures show up before rollout. Expect the security team to review the final permission set and the platform team to own the service account, unit file or pod security settings after handover.
How long does it take, and why does duration vary so much?
Duration depends on scope, not on a fixed template. The main drivers are the number of deployments, how many of them need host access, how many operating systems and container platforms are involved, and how quickly access owners respond. A single gateway with no host access is a small change. A fleet of agents reading node logs across several Linux distributions takes longer because each variant needs testing. Ask for a written plan that lists the deployments, the permission changes for each, the test matrix and the approval steps. Duration should follow from that plan, and it should be stated in the quote.
Does a gateway-only Collector still need host access?
Usually not. A gateway that receives OTLP from agents or applications and forwards data to back ends normally needs only a network listener, outbound connections to exporters and a readable configuration file. Host access becomes relevant when the gateway also scrapes local host metrics, reads files or collects node-level data. Confirm this by listing every receiver in the gateway configuration. Any receiver that reads from the filesystem, the process table or a kernel interface is a host-access requirement, even if the Collector runs in a container. Move those receivers to agents where possible so the gateway can stay unprivileged.
How do we verify the change before and after rollout?
Verification combines configuration review with runtime checks. Before rollout, confirm that the process runs under a non-root user, that its capabilities are limited to what the receivers need, and that file reads succeed for each configured path. In a test environment, run every receiver and exporter and compare the telemetry produced with the output from the current deployment. After rollout, watch for dropped data, permission denied errors and restarts in the Collector's own logs and internal metrics. Keep a record of the permission set per deployment so a reviewer can trace each grant to a receiver and an owner. The Collector's configuration and security guidance at OpenTelemetry Collector configuration best practices is the natural starting reference for these checks.
What ongoing work follows after upgrades?
Each Collector upgrade can change default settings, component names, stability levels or the files a component reads, so permissions need a recheck after every upgrade. Track the release notes for the distribution you run, rerun your receiver tests in a staging environment and confirm the process still starts without extra privileges. Keep the permission record current when receivers are added or removed, and review host-access grants on a regular schedule with their owners. If you use a custom build, rebuild and retest it whenever the components change. Ask any provider whether upgrade testing and permission reviews are included in a one-time engagement or in an ongoing support arrangement.
How DeployOpen scopes least-privilege Collector work
DeployOpen plans and implements self-hosted Collector deployments inside your own cloud accounts, data centers or air-gapped networks, and the least-privilege work starts with a written scope agreed before any change is made. The first deliverable is a receiver and host access review: every receiver, extension and processor in the planned configuration is listed with the network interface it binds to, the ports it opens, the credentials it uses and the host paths or APIs it reads. Each entry is matched against a stated reason, such as host metrics from /proc and /sys, container logs from the node filesystem, or an authenticator extension validating incoming requests. Anything without a reason is removed from the design before deployment.
The hardening phase then applies the decisions from that review. Components that need host access run in a separate, narrowly privileged deployment, while the gateway or general-purpose agent runs as a non-root user with read access only to the files it needs and no Linux capabilities beyond those required. DeployOpen checks the pod or service definition for privilege escalation, host networking and writable root filesystems, and confirms that the Collector process, not a wrapper script, is the one running with that identity. Verification covers the running configuration, not only the manifest: the team confirms the process user, the bound addresses and the reachable ports on a test host, and records each check so your security team can repeat it after every upgrade.
Handover includes the review register, the final role and permission definitions, the configuration files with their change history, the verification scripts and a runbook describing how to add a receiver without widening access. Ask any provider to state in the written scope which hosts, platforms and privilege levels are in scope, who approves exceptions to the non-root baseline, and whether upgrade checks and periodic retesting are included or offered as a retainer. Confirm with your platform team the exact Collector release you will run, and review its current release notes before you rely on any default, since binding and permission behavior can change between versions.
How DeployOpen delivers OpenTelemetry hardening engagements
DeployOpen works on least-privilege Collector deployments inside your own infrastructure, starting from a written inventory of which receivers and host sources each pipeline really needs. We scope, build, test and document the deployment so your security and platform teams can review every permission before it reaches production.
How we scope
- Inventory every Collector pipeline and list the receivers, processors and exporters each one uses.
- Identify which pipelines need host metrics, node logs or other host access, and which can run unprivileged.
- Agree the written scope, deliverables and timeline before work starts, since most engagements are fixed-scope.
- Confirm the Collector distribution, deployment pattern and target platforms in your own environment.
How we build
- Create a non-root runtime user and map the minimum file, socket and capability grants each pipeline needs.
- Restrict host mounts to read-only paths and document any elevated access that remains necessary.
- Bind receivers and extensions to the interfaces you choose, and keep diagnostic endpoints off public networks.
- Test the configuration in a non-production environment and check that each pipeline still collects the data it should.
How we hand over
- Deliver the configuration, permission map and deployment manifests as code your team can version and review.
- Document the reason for every privileged or host-level permission, with the data source it supports.
- Provide a test record showing which denied actions were verified and how each pipeline behaves when restricted.
- Walk your platform and security engineers through the runbook for changing permissions in future.
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer after handover.
- Re-check permissions when the Collector version, components or host images change.
- Retest the deployment after significant changes so new privileges do not go unnoticed.
- Confirm the support scope and response expectations in writing as part of the retainer quote.

