diff --git a/src/tscore/ink_cap.cc b/src/tscore/ink_cap.cc index 0f0d6f869e2..f464daad3b1 100644 --- a/src/tscore/ink_cap.cc +++ b/src/tscore/ink_cap.cc @@ -156,8 +156,10 @@ impersonate(const struct passwd *pwd, ImpersonationLevel level) #endif // Always repopulate the supplementary group list for the new user. - if (initgroups(pwd->pw_name, pwd->pw_gid) != 0) { - Fatal("switching to user %s, failed to initialize supplementary groups ID %ld", pwd->pw_name, (long)pwd->pw_gid); + if (geteuid() == 0) { // check that we have enough rights to call initgroups() + if (initgroups(pwd->pw_name, pwd->pw_gid) != 0) { + Fatal("switching to user %s, failed to initialize supplementary groups ID %ld", pwd->pw_name, (long)pwd->pw_gid); + } } switch (level) {