diff --git a/asterisk.c b/asterisk.c
index 21136ddb52719f3011c7395883c0f9b84e26b337..3563b41b249feeea8e2c0cd465a0d19ec0b8116b 100644
--- a/asterisk.c
+++ b/asterisk.c
@@ -2171,7 +2171,11 @@ int main(int argc, char *argv[])
 			ast_log(LOG_WARNING, "No such user '%s'!\n", runuser);
 			exit(1);
 		}
-		if (!ast_strlen_zero(rungroup)) {
+		if (!rungroup) {
+			if (setgid(pw->pw_gid)) {
+				ast_log(LOG_WARNING, "Unable to setgid to %d!\n", pw->pw_gid);
+				exit(1);
+			}
 			if (initgroups(pw->pw_name, pw->pw_gid)) {
 				ast_log(LOG_WARNING, "Unable to init groups for '%s'\n", runuser);
 				exit(1);