Skip to content

Commit 71c9bc1

Browse files
author
Ralph Castain
authored
Merge pull request #3242 from jsquyres/pr/orterun-run-as-root-minor-tweaks
orte: minor tweaks to run-as-root message
2 parents b398d72 + a333cf6 commit 71c9bc1

File tree

3 files changed

+25
-37
lines changed

3 files changed

+25
-37
lines changed

orte/orted/orted_submit.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved
1414
* Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
1515
* Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights
1616
* reserved.
@@ -322,18 +322,22 @@ int orte_submit_init(int argc, char *argv[],
322322
* exit with a giant warning flag
323323
*/
324324
if (0 == geteuid() && !orte_cmd_options.run_as_root) {
325+
/* show_help is not yet available, so print an error manually */
325326
fprintf(stderr, "--------------------------------------------------------------------------\n");
326327
if (orte_cmd_options.help) {
327-
fprintf(stderr, "%s cannot provide the help message when run as root.\n", orte_basename);
328+
fprintf(stderr, "%s cannot provide the help message when run as root.\n\n", orte_basename);
328329
} else {
329-
/* show_help is not yet available, so print an error manually */
330-
fprintf(stderr, "%s has detected an attempt to run as root.\n", orte_basename);
330+
fprintf(stderr, "%s has detected an attempt to run as root.\n\n", orte_basename);
331331
}
332-
fprintf(stderr, "Running as root is *strongly* discouraged as any mistake (e.g., in\n");
332+
333+
fprintf(stderr, "Running at root is *strongly* discouraged as any mistake (e.g., in\n");
333334
fprintf(stderr, "defining TMPDIR) or bug can result in catastrophic damage to the OS\n");
334335
fprintf(stderr, "file system, leaving your system in an unusable state.\n\n");
336+
337+
fprintf(stderr, "We strongly suggest that you run %s as a non-root user.\n\n", orte_basename);
338+
335339
fprintf(stderr, "You can override this protection by adding the --allow-run-as-root\n");
336-
fprintf(stderr, "option to your cmd line. However, we reiterate our strong advice\n");
340+
fprintf(stderr, "option to your command line. However, we reiterate our strong advice\n");
337341
fprintf(stderr, "against doing so - please do so at your own risk.\n");
338342
fprintf(stderr, "--------------------------------------------------------------------------\n");
339343
exit(1);

orte/tools/orte-dvm/orte-dvm.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved
1414
* Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
1515
* Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights
1616
* reserved.
@@ -221,18 +221,22 @@ int main(int argc, char *argv[])
221221
* exit with a giant warning flag
222222
*/
223223
if (0 == geteuid() && !myglobals.run_as_root) {
224+
/* show_help is not yet available, so print an error manually */
224225
fprintf(stderr, "--------------------------------------------------------------------------\n");
225226
if (myglobals.help) {
226-
fprintf(stderr, "%s cannot provide the help message when run as root\n", orte_basename);
227+
fprintf(stderr, "%s cannot provide the help message when run as root.\n\n", orte_basename);
227228
} else {
228-
/* show_help is not yet available, so print an error manually */
229-
fprintf(stderr, "%s has detected an attempt to run as root.\n", orte_basename);
229+
fprintf(stderr, "%s has detected an attempt to run as root.\n\n", orte_basename);
230230
}
231-
fprintf(stderr, " This is *strongly* discouraged as any mistake (e.g., in defining TMPDIR) or bug can\n");
232-
fprintf(stderr, "result in catastrophic damage to the OS file system, leaving\n");
233-
fprintf(stderr, "your system in an unusable state.\n\n");
231+
232+
fprintf(stderr, "Running at root is *strongly* discouraged as any mistake (e.g., in\n");
233+
fprintf(stderr, "defining TMPDIR) or bug can result in catastrophic damage to the OS\n");
234+
fprintf(stderr, "file system, leaving your system in an unusable state.\n\n");
235+
236+
fprintf(stderr, "We strongly suggest that you run %s as a non-root user.\n\n", orte_basename);
237+
234238
fprintf(stderr, "You can override this protection by adding the --allow-run-as-root\n");
235-
fprintf(stderr, "option to your cmd line. However, we reiterate our strong advice\n");
239+
fprintf(stderr, "option to your command line. However, we reiterate our strong advice\n");
236240
fprintf(stderr, "against doing so - please do so at your own risk.\n");
237241
fprintf(stderr, "--------------------------------------------------------------------------\n");
238242
exit(1);

orte/tools/orterun/orterun.c

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved
1414
* Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
1515
* Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights
1616
* reserved.
@@ -130,32 +130,12 @@ int orterun(int argc, char *argv[])
130130
{
131131
orte_submit_status_t launchst, completest;
132132

133+
/* orte_submit_init() will also check if the user is running as
134+
root (and may issue a warning/exit). */
133135
if (ORTE_SUCCESS != orte_submit_init(argc, argv, NULL)) {
134136
exit(1);
135137
}
136138

137-
/* check if we are running as root - if we are, then only allow
138-
* us to proceed if the allow-run-as-root flag was given. Otherwise,
139-
* exit with a giant warning flag
140-
*/
141-
if (0 == geteuid() && !orte_cmd_options.run_as_root) {
142-
fprintf(stderr, "--------------------------------------------------------------------------\n");
143-
if (orte_cmd_options.help) {
144-
fprintf(stderr, "%s cannot provide the help message when run as root.\n", orte_basename);
145-
} else {
146-
/* show_help is not yet available, so print an error manually */
147-
fprintf(stderr, "%s has detected an attempt to run as root.\n", orte_basename);
148-
}
149-
fprintf(stderr, "Running at root is *strongly* discouraged as any mistake (e.g., in\n");
150-
fprintf(stderr, "defining TMPDIR) or bug can result in catastrophic damage to the OS\n");
151-
fprintf(stderr, "file system, leaving your system in an unusable state.\n\n");
152-
fprintf(stderr, "You can override this protection by adding the --allow-run-as-root\n");
153-
fprintf(stderr, "option to your cmd line. However, we reiterate our strong advice\n");
154-
fprintf(stderr, "against doing so - please do so at your own risk.\n");
155-
fprintf(stderr, "--------------------------------------------------------------------------\n");
156-
exit(1);
157-
}
158-
159139
/* setup to listen for commands sent specifically to me, even though I would probably
160140
* be the one sending them! Unfortunately, since I am a participating daemon,
161141
* there are times I need to send a command to "all daemons", and that means *I* have

0 commit comments

Comments
 (0)