Skip to content

Enabling sudo under srun #1620

Closed Answered by tpdownes
yaroslavvb asked this question in Q&A
Jul 26, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

I suggest adding the following script settings to your controller module. The example below is adapted from examples/hpc-slurm.yaml.

With these settings, I am able to run srun -N1 -p debug sudo whoami and it returns root as you'd expect. Without the, you get the interactive prompt.

I am configured as roles/compute.osAdminLogin in the project.

  - id: slurm_controller
    source: community/modules/scheduler/schedmd-slurm-gcp-v5-controller
    use:
    - network1
    - debug_partition
    - compute_partition
    settings:
      disable_controller_public_ips: false
      compute_startup_script: |
        #!/bin/bash
        mkdir /var/slurm-sudoers.d
        chmod 750 /var/slurm-sudoers.d

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@yaroslavvb
Comment options

Answer selected by yaroslavvb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants