Skip to content

Commit

Permalink
Fix: running job's from user and with started SLURM from non-root user
Browse files Browse the repository at this point in the history
  • Loading branch information
karasevb committed Jun 14, 2016
1 parent ec4138b commit 50700b9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,20 @@ Prerequisites: `screen` tool.
and others know how to reach `slurmctld`.
10. Restart lxc-net service (for Ubuntu/Mint):
- `$ sudo service lxc-net restart`
11. Start your cluster:
11. [Optional] If you set 'SLURM_USER' is not root-user and will have need running jobs from other users:
- Add you user to group with user 'SLURM_USER' (/etc/group)
- Setup SLURM capabilities:
* `$ sudo ./slurm-set-capabilities.sh`
- Set patch from SLURM directory:
* `patch -p1 < start_from_user.patch`
12. Start your cluster:
- `$ sudo ./slxc-run-cluster.sh`
12. Verify that everything is OK (both tools should show all your virtual "machines" running):
13. Verify that everything is OK (both tools should show all your virtual "machines" running):
- `$ sudo screen -ls`
- `$ sudo lxc-ls --active`
13. Now you can attach to any machine with
14. Now you can attach to any machine with
- `$ sudo lxc-attach -n $nodename`
14. To shutdown your cluster use
15. To shutdown your cluster use
- `$ ./slxc-stop-cluster.sh`
- NOTE: that it may take a while. You can speedup this process by setting
`LXC_SHUTDOWN_TIMEOUT` in `/etc/default/lxc` (for Ubuntu and Mint)
Expand Down
15 changes: 15 additions & 0 deletions patch/start_from_user.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/src/slurmd/slurmstepd/mgr.c b/src/slurmd/slurmstepd/mgr.c
index c7eeb29..cd2a528 100644
--- a/src/slurmd/slurmstepd/mgr.c
+++ b/src/slurmd/slurmstepd/mgr.c
@@ -2411,8 +2411,8 @@ _drop_privileges(stepd_step_rec_t *job, bool do_setuid,
/*
* No need to drop privileges if we're not running as root
*/
- if (getuid() != (uid_t) 0)
- return SLURM_SUCCESS;
+ //if (getuid() != (uid_t) 0)
+ // return SLURM_SUCCESS;

if (setegid(job->gid) < 0) {
error("setegid: %m");
7 changes: 7 additions & 0 deletions slurm-set-capabilities.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

. ./slxc.conf

CAPLIST="cap_chown,cap_setgid,cap_setuid,cap_fowner+ep"

setcap $CAPLIST $SLURM_PATH/sbin/slurmstepd

0 comments on commit 50700b9

Please sign in to comment.