pam_slurm_adopt is a Pluggable Authentication Module (PAM) that blocks SSH logins to compute nodes where the user has no running job, and also ensures that SSH-launched processes are placed under the job’s extern step cgroup so resource limits apply and processes are cleaned up when the job ends.
This guide explains how to enable pam_slurm_adopt on SUNK compute nodes. When it’s active, users can no longer SSH directly to a compute node outside of a job allocation to bypass Slurm resource management.
SUNK doesn’t configure pam_slurm_adopt for you, and compute nodes accept SSH by default in SUNK 8.0 and later. Until you configure it, any user with a provisioned SSH key can log in to any compute node and start work outside Slurm, which escapes resource accounting and can drain the node. Configure it on any SUNK cluster where users hold SSH keys.
pam_slurm_adopt enforces authorization (whether a user is allowed to access a specific node), not authentication. Users authenticate using SSH keys distributed through SUNK User Provisioning. Authentication and authorization must both succeed to establish an SSH connection to a compute node.Prerequisites
SUNK User Provisioning (SUP) must distribute users’ SSH keys to the compute nodes. See Provision users in SUNK.Enable on SUNK Self-Service
On SUNK Self-Service, the Slurm settings thatpam_slurm_adopt depends on are already in place: PrologFlags includes Contain, ProctrackType is proctrack/cgroup, TaskPlugin includes task/cgroup, sshd runs with UsePAM yes, and the compute image includes pam_slurm_adopt.so. You only add the PAM rule.
The PAM configuration file (/etc/pam.d/sshd) isn’t persistent, so inject the rule each time a compute container starts. Add a oneshot s6 script that targets compute to spec.s6 in your SunkCluster manifest:
sunkcluster.yaml
account rule for pam_slurm_adopt after the @include common-account line in /etc/pam.d/sshd. $(uname -m) resolves the module path for the node’s architecture: x86_64 or aarch64. The leading - means PAM skips the rule if the module file isn’t found, rather than failing the login. timeoutUp is required for oneshot script entries. Because the entry targets only compute, the rule doesn’t reach the login node.
Apply the updated manifest:
Enable on SUNK Standard
Before you begin
SSH must be enabled on compute nodes (compute.ssh.enabled: true), which is the default on CoreWeave clusters. See Configure compute nodes for SUNK Standard.
SUNK requires the following Slurm configuration values and sets them by default. Confirm they are present in your values.yaml before continuing:
Step 1: Add Contain to PrologFlags
pam_slurm_adopt requires PrologFlags to include Contain. With this flag set, Slurm creates a PAM container for each job on the node, which allows the module to verify whether an SSH login belongs to an active allocation.
Whether SUNK already adds Contain depends on the SUNK version:
- SUNK 8.1 and later: the SUNK operator appends
Containwhile Slurm’snamespace/linuxplugin is on, which is the default. If you setContainyourself, the operator doesn’t add it a second time. If the plugin is off, for example because you setslurmConfig.namespaceConfig.enabled: false, setContainyourself. First removeNoHoldfromPrologFlags, if present, because Slurm rejects it alongsideContain. For the other cases where the operator leaves the plugin off, see Diagnose unexplained memory pressure on a SUNK node. - SUNK 8.0: set
Containyourself. - SUNK 7.6 and later 7.x releases: the chart appends
ContainwhileslurmConfig.JobContainerTypeisjob_container/tmpfs, which is the default. WhenJobContainerTypeis empty, the chart removesContainfromPrologFlags, even if you set it. Keep the defaultJobContainerTypeon these releases. - SUNK 7.5 and earlier: set
Containyourself.
Contain to the existing PrologFlags value in your values.yaml (the SUNK default is Alloc,Serial). Use the list form, which every SUNK version accepts. On SUNK 7.6 and later 7.x releases, the chart fails to render a comma-separated string.
pam_slurm_adopt uses to verify SSH logins. Proceed to Step 2 to inject the PAM rule.
Step 2: Inject the PAM rule with an s6 script
SUNK compute nodes run inside containers. The PAM configuration file (/etc/pam.d/sshd) isn’t persistent, so you must inject the pam_slurm_adopt rule each time the container starts. Use an s6 oneshot script under compute.s6 in your values.yaml to do this:
account rule for pam_slurm_adopt after the @include common-account line in /etc/pam.d/sshd. $(uname -m) resolves the module path for the node’s architecture: x86_64 or aarch64. The leading - means PAM skips the rule if the module file isn’t found, rather than failing the login.
Apply the changes
With bothvalues.yaml changes in place, upgrade the Helm release to apply them to the cluster. Replace [RELEASE-NAME] with the name of your Slurm Helm release, and [NAMESPACE] with the Kubernetes namespace where SUNK is deployed (typically tenant-slurm):
Expected behavior
After the changes take effect, the following behavior applies when users SSH to a compute node:- Users with an active Slurm job allocation on the target node can SSH in. Slurm adopts their SSH session as a job step and tracks it for resource accounting.
- Users without an active allocation on the target node are denied access, regardless of whether their SSH key is valid.
- Users can still SSH to the Slurm login node at any time. The allocation check applies only to compute nodes.
ProxyJump, see Access Slurm compute nodes.