Skip to content

Conversation

@rhc54
Copy link
Contributor

@rhc54 rhc54 commented Aug 24, 2018

Per suggestion by @bangerth, allow mpirun to execute as root if two
envars are set to specific values

Per conversation with @jsquyres, name the envars OMPI_ALLOW_RUN_AS_ROOT
and OMPI_ALLOW_RUN_AS_ROOT_CONFIRM

Fixes #4451

Signed-off-by: Ralph Castain rhc@open-mpi.org

@rhc54 rhc54 requested a review from jsquyres August 24, 2018 23:42
Per suggestion by @bangerth, allow mpirun to execute as root if two envars are set to specific values Per conversation with @jsquyres, name the envars OMPI_ALLOW_RUN_AS_ROOT and OMPI_ALLOW_RUN_AS_ROOT_CONFIRM Fixes #4451 Signed-off-by: Ralph Castain <rhc@open-mpi.org> Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Copy link
Member

@jsquyres jsquyres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhc54 I added more text to the man page.

@rhc54 rhc54 merged commit a0ea197 into open-mpi:master Aug 25, 2018
@rhc54 rhc54 deleted the topic/root branch September 21, 2018 13:09
@simonbyrne
Copy link
Contributor

Should this part be changed as well?:

if (0 == geteuid() && !orte_cmd_options.run_as_root) {
fprintf(stderr, "--------------------------------------------------------------------------\n");
if (NULL != orte_cmd_options.help) {
fprintf(stderr, "%s cannot provide the help message when run as root.\n", orte_basename);
} else {
/* show_help is not yet available, so print an error manually */
fprintf(stderr, "%s has detected an attempt to run as root.\n", orte_basename);
}
fprintf(stderr, "Running at root is *strongly* discouraged as any mistake (e.g., in\n");
fprintf(stderr, "defining TMPDIR) or bug can result in catastrophic damage to the OS\n");
fprintf(stderr, "file system, leaving your system in an unusable state.\n\n");
fprintf(stderr, "You can override this protection by adding the --allow-run-as-root\n");
fprintf(stderr, "option to your cmd line. However, we reiterate our strong advice\n");
fprintf(stderr, "against doing so - please do so at your own risk.\n");
fprintf(stderr, "--------------------------------------------------------------------------\n");
exit(1);
}

simonbyrne added a commit to simonbyrne/ompi that referenced this pull request Aug 12, 2019
I found that I needed to apply the same change as open-mpi#5597 to orterun.c for the environment variables to work correctly.
simonbyrne added a commit to simonbyrne/ompi that referenced this pull request Aug 13, 2019
I found that I needed to apply the same change as open-mpi#5597 to orterun.c for the environment variables to work correctly. Signed-off-by: Simon Byrne <simonbyrne@gmail.com>
jsquyres pushed a commit to jsquyres/ompi that referenced this pull request Aug 19, 2019
I found that I needed to apply the same change as open-mpi#5597 to orterun.c for the environment variables to work correctly. Signed-off-by: Simon Byrne <simonbyrne@gmail.com> (cherry picked from commit 9c8671c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment