@@ -324,6 +324,14 @@ int orte_submit_init(int argc, char *argv[],
324
324
* exit with a giant warning flag
325
325
*/
326
326
if (0 == geteuid () && !orte_cmd_options .run_as_root ) {
327
+ /* check for two envars that allow override of this protection */
328
+ char * r1 , * r2 ;
329
+ if (NULL != (r1 = getenv ("OMPI_ALLOW_RUN_AS_ROOT" )) &&
330
+ NULL != (r2 = getenv ("OMPI_ALLOW_RUN_AS_ROOT_CONFIRM" ))) {
331
+ if (0 == strcmp (r1 , "1" ) && 0 == strcmp (r2 , "1" )) {
332
+ goto moveon ;
333
+ }
334
+ }
327
335
/* show_help is not yet available, so print an error manually */
328
336
fprintf (stderr , "--------------------------------------------------------------------------\n" );
329
337
if (orte_cmd_options .help ) {
@@ -338,13 +346,17 @@ int orte_submit_init(int argc, char *argv[],
338
346
339
347
fprintf (stderr , "We strongly suggest that you run %s as a non-root user.\n\n" , orte_basename );
340
348
341
- fprintf (stderr , "You can override this protection by adding the --allow-run-as-root\n" );
342
- fprintf (stderr , "option to your command line. However, we reiterate our strong advice\n" );
343
- fprintf (stderr , "against doing so - please do so at your own risk.\n" );
349
+ fprintf (stderr , "You can override this protection by adding the --allow-run-as-root option\n" );
350
+ fprintf (stderr , "to the cmd line or by setting two environment variables in the following way:\n" );
351
+ fprintf (stderr , "the variable OMPI_ALLOW_RUN_AS_ROOT=1 to indicate the desire to override this\n" );
352
+ fprintf (stderr , "protection, and OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 to confirm the choice and\n" );
353
+ fprintf (stderr , "add one more layer of certainty that you want to do so.\n" );
354
+ fprintf (stderr , "We reiterate our advice against doing so - please proceed at your own risk.\n" );
344
355
fprintf (stderr , "--------------------------------------------------------------------------\n" );
345
356
exit (1 );
346
357
}
347
358
359
+ moveon :
348
360
/* process any mca params */
349
361
rc = mca_base_cmd_line_process_args (orte_cmd_line , & environ , & environ );
350
362
if (ORTE_SUCCESS != rc ) {
0 commit comments