@@ -324,6 +324,14 @@ int orte_submit_init(int argc, char *argv[],
324324 * exit with a giant warning flag
325325 */
326326 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+ }
327335 /* show_help is not yet available, so print an error manually */
328336 fprintf (stderr , "--------------------------------------------------------------------------\n" );
329337 if (orte_cmd_options .help ) {
@@ -338,13 +346,17 @@ int orte_submit_init(int argc, char *argv[],
338346
339347 fprintf (stderr , "We strongly suggest that you run %s as a non-root user.\n\n" , orte_basename );
340348
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" );
344355 fprintf (stderr , "--------------------------------------------------------------------------\n" );
345356 exit (1 );
346357 }
347358
359+ moveon :
348360 /* process any mca params */
349361 rc = mca_base_cmd_line_process_args (orte_cmd_line , & environ , & environ );
350362 if (ORTE_SUCCESS != rc ) {
0 commit comments