pam_namespace creates session-specific mount views, not a general authorization boundary
Multi-user Linux systems often want each login to see a private /tmp, a separate home-like view, or a per-user instance of a shared directory. The pam_namespace module can create that view by setting up a private mount namespace for the session and mounting polyinstantiated directories. It improves separation, but the result is a filesystem view tied to a login session, not a complete authorization system.
PAM_NAMESPACE(8) describes a module that configures a namespace for a session with polyinstantiated directories. An instance can be selected by user name, by SELinux security context, or by both. namespace.conf(5) supplies the directory templates and mount options used by the module.
The module is normally part of the privileged login path. A misconfigured template can mount the wrong path into a session, reuse another user's instance, or leave a mount visible longer than intended. The configuration therefore needs review like any other privileged daemon setting, including ownership, mode, SELinux labels, and the behavior of any namespace.init script.
What isolation changes
A session inside a private mount namespace can see a different tree from another session on the host. That can prevent casual cross-user observation of temporary files and give applications a predictable directory. It does not change network access, process visibility, kernel interfaces, or application authorization. Two processes can be in the same mount namespace and still be governed by different users, capabilities, and security labels.
Path identity also changes across namespace boundaries. A file recorded as /tmp/cache in the login can map to a polyinstantiated backing path on the host. An administrator investigating an incident must recover the namespace and backing-store context before deleting or trusting the file. A backup tool that reads only the host path may miss the per-session instance.
The propagation mode of the mount matters. Shared mounts can propagate events between namespaces, while private or slave relationships limit that flow. If the configuration exposes a host path inside the session, the new mount view does not make the underlying file private. A read-only mount can still disclose data, and a writable bind mount can still alter the original object.
Deployment checks
After login, inspect /proc/<pid>/mountinfo for the session's actual mounts and compare it with the expected template. Open a second session for the same user and confirm whether the policy intends the instance to be shared or isolated. Test a mount failure and verify that authentication fails closed or reports a clear error instead of silently presenting the host view.
Use pam_namespace with user isolation where temporary data is the concern. Pair it with a separate policy for process isolation, network access, and application roles. Log the namespace creation result and the backing path or label selected by the policy, without logging file contents.
A namespace is an object view. Security decisions should still identify the user, process, credential, and data explicitly. The login module can create a safer view, but it cannot decide whether an application should read or change the file inside that view.