The /proc filesystem can reveal command lines, process ownership, resource use, and the names of programs running under other accounts. Linux provides the hidepid= mount option to restrict that visibility [1]. It is a useful local-information control, but its effect depends on the procfs instance, the process namespace, the authorized group, and the workloads that need to inspect one another.

What each mode changes

The kernel documentation defines hidepid=off or hidepid=0 as the classic mode in which users may access every /proc/<pid>/ directory. hidepid=noaccess or hidepid=1 prevents users from accessing another user's process directories while leaving enough information to learn that a process may exist. hidepid=invisible or hidepid=2 also hides the process identity and ownership details. hidepid=ptraceable or hidepid=4 exposes only process directories that the caller is allowed to ptrace [1].

These modes protect different information. Mode 1 is useful against local users reading another service's command-line arguments or status files. Mode 2 makes discovery of running services more difficult, but the kernel documentation notes that the existence of a particular PID may still be learned through other behavior. Mode 4 aligns visibility with ptrace permission, which may be a better fit for debugging and incident work but requires a clear model of who may inspect which process.

The scope is the procfs instance

The kernel documentation describes modern procfs mounts as separate instances whose options affect that mount rather than every procfs mount in the same PID namespace. It also includes a version-dependent note that older behavior treated the options as global among mountpoints in a namespace. An operator should inspect /proc/mounts or /proc/self/mountinfo in the actual namespace instead of assuming that a host-wide setting propagated into a container.

That distinction matters for containers and services with private mount namespaces. A container can see a procfs mount whose policy differs from the host's. A service manager can create a restricted view for one unit while leaving the host's administrative view intact. The security review should identify which mount each process actually sees and which process namespace supplies its PIDs.

Authorize the exception

gid= defines a group that may learn process information otherwise restricted by hidepid=. The exception should be based on a job that needs the visibility, such as a monitoring or diagnostic agent. Membership in that group becomes a sensitive permission. Review additions, remove stale members, and avoid placing broad application service accounts in the group.

Do not use hidepid as a substitute for process memory protections or filesystem permissions. A process that cannot list another process may still interact with it over a local socket, a shared file, or a privileged helper. The control reduces information gathering and some command-line leakage; it does not remove the attack surface of the running service.

Test the behavior

Use a disposable host or namespace with two ordinary test users. Start a harmless long-running process under one user and inspect /proc/<pid> from the other. Record the result for each mode. Test the authorized group, a process in a different PID namespace, and a process whose command line contains a harmless canary string. Remove the test process and configuration afterward.

Run the same checks from the service manager's view. A systemd unit may expose a restricted procfs through its own sandboxing settings [2]. Confirm the effective mount and the process's own access. A successful unit start does not show whether hidepid is active, and a hidden process may still be visible to a privileged diagnostic tool.

Operational consequences

Monitoring agents may fail when they can no longer enumerate processes. Application performance tools may lose the metadata they expect. Incident responders may need a separate administrative view, but that access should be logged and time-bounded. Test upgrades because a changed mount namespace or service sandbox can alter the result.

If an intruder is suspected of process discovery, preserve the audit and authentication records before changing the mount. The absence of a process list in one namespace does not prove that the intruder did not discover the service through network behavior, timing, or a shared socket. Treat hidepid as one evidence source in a larger containment plan.

A defensible baseline

Document the procfs policy for the host, each container runtime, and each system service that needs a private view. Assign the gid= exception to a specific role. Monitor the mounts and namespace identity during configuration changes. Test both information visibility and the workflows that legitimately need process metadata.

The practical claim is narrow: hidepid can stop an unprivileged process from reading another process's information through a particular procfs mount. It does not make the process invisible in every dimension and does not isolate services from their other shared resources. That precision is what makes the control useful.

References

[1] The /proc filesystem

[2] systemd.exec manual