aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-12-09 23:26:12 +0000
committerNick Mathewson <nickm@torproject.org>2008-12-09 23:26:12 +0000
commitd60d8976b921d141ffaeee43cd87cd2bc43c3654 (patch)
treed2c297617d8fbbc4afb262f140ca368404805bb7
parentab75c0d9e3dce71552c10ecb3a1f59e133a79e2d (diff)
downloadtor-d60d8976b921d141ffaeee43cd87cd2bc43c3654.tar
tor-d60d8976b921d141ffaeee43cd87cd2bc43c3654.tar.gz
Better error message when told to setuid to ourself.
svn:r17543
-rw-r--r--ChangeLog5
-rw-r--r--src/common/compat.c13
2 files changed, 16 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 512785a15..29b0e6de9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
Changes in version 0.2.1.9-alpha - 200?-??-??
+ o Minor features:
+ - Give a better error message when an overzealous init script says,
+ "sudo -u username tor --user username". Makes Bug 882 easier
+ for users to diagnose.
+
o Minor features (controller):
- New CONSENSUS_ARRIVED event to note when a new consensus has
been fetched and validated.
diff --git a/src/common/compat.c b/src/common/compat.c
index 217c9e984..51172d77b 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;
}