From d60d8976b921d141ffaeee43cd87cd2bc43c3654 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 9 Dec 2008 23:26:12 +0000 Subject: Better error message when told to setuid to ourself. svn:r17543 --- src/common/compat.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/common/compat.c b/src/common/compat.c index 217c9e9849..51172d77be 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -1103,9 +1103,18 @@ switch_id(const char *user) /* Properly switch egid,gid,euid,uid here or bail out */ if (setgroups(1, &pw->pw_gid)) { - log_warn(LD_GENERAL, "Error setting groups to gid %d: \"%s\". " - "If you set the \"User\" option, you must start Tor as root.", + log_warn(LD_GENERAL, "Error setting groups to gid %d: \"%s\".", (int)pw->pw_gid, strerror(errno)); + if (old_uid == pw->pw_uid) { + log_warn(LD_GENERAL, "Tor is already running as %s. You do not need " + "the \"User\" option if you are already running as the user " + "you want to be. (If you did not set the User option in your " + "torrc, check whether it was specified on the command line " + "by a startup script.)", user); + } else { + log_warn(LD_GENERAL, "If you set the \"User\" option, you must start Tor" + " as root."); + } return -1; } -- cgit v1.2.3-54-g00ecf