Skip to content

Commit 4e06be1

Browse files
authored
Merge pull request #6895 from simonbyrne/sb/root
Run-as-root env vars in orterun.c
2 parents 1e15c0b + 9c8671c commit 4e06be1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

orte/tools/orterun/orterun.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ int orterun(int argc, char *argv[])
142142
* exit with a giant warning flag
143143
*/
144144
if (0 == geteuid() && !orte_cmd_options.run_as_root) {
145+
char *r1, *r2;
146+
if (NULL != (r1 = getenv("OMPI_ALLOW_RUN_AS_ROOT")) &&
147+
NULL != (r2 = getenv("OMPI_ALLOW_RUN_AS_ROOT_CONFIRM"))) {
148+
if (0 == strcmp(r1, "1") && 0 == strcmp(r2, "1")) {
149+
goto moveon;
150+
}
151+
}
152+
145153
fprintf(stderr, "--------------------------------------------------------------------------\n");
146154
if (NULL != orte_cmd_options.help) {
147155
fprintf(stderr, "%s cannot provide the help message when run as root.\n", orte_basename);
@@ -159,6 +167,7 @@ int orterun(int argc, char *argv[])
159167
exit(1);
160168
}
161169

170+
moveon:
162171
/* setup to listen for commands sent specifically to me, even though I would probably
163172
* be the one sending them! Unfortunately, since I am a participating daemon,
164173
* there are times I need to send a command to "all daemons", and that means *I* have

0 commit comments

Comments
 (0)