diff --git a/src/main/mainconfig.c b/src/main/mainconfig.c
index d067da5..595f787 100644
--- a/src/main/mainconfig.c
+++ b/src/main/mainconfig.c
@@ -426,6 +426,17 @@ static int r_mkdir(const char *part)
 #ifdef HAVE_SETUID
 static int doing_setuid = FALSE;
 
+static void fr_enable_dumpable(void) {
+#ifdef HAVE_SYS_PRCTL_H
+#ifdef PR_SET_DUMPABLE
+	if (prctl(PR_SET_DUMPABLE, 1) < 0) {
+		radlog(L_ERR,"Cannot enable core dumps: prctl(PR_SET_DUMPABLE) failed: '%s'",
+			   strerror(errno));
+	}
+#endif
+#endif
+}
+
 #if defined(HAVE_SETRESUID) && defined (HAVE_GETRESUID)
 void fr_suid_up(void)
 {
@@ -445,6 +456,8 @@ void fr_suid_up(void)
 		radlog(L_ERR, "Switched to unknown UID");
 		_exit(1);
 	}
+	
+	fr_enable_dumpable();
 }
 
 void fr_suid_down(void)
@@ -456,12 +469,14 @@ void fr_suid_down(void)
 			progname, uid_name, strerror(errno));
 		_exit(1);
 	}
-		
+
 	if (geteuid() != server_uid) {
 		fprintf(stderr, "%s: Failed switching uid: UID is incorrect\n",
 			progname);
 		_exit(1);
 	}
+
+	fr_enable_dumpable();
 }
 
 void fr_suid_down_permanent(void)
@@ -478,6 +493,8 @@ void fr_suid_down_permanent(void)
 		radlog(L_ERR, "Switched to unknown uid");
 		_exit(1);
 	}
+	
+	fr_enable_dumpable();
 }
 #else
 /*
@@ -495,6 +512,7 @@ void fr_suid_down(void)
 			progname, uid_name, strerror(errno));
 		_exit(1);
 	}
+	fr_enable_dumpable();
 }
 void fr_suid_down_permanent(void)
 {
@@ -615,6 +633,7 @@ static int switch_users(CONF_SECTION *cs)
 			progname, gid_name, strerror(errno));
 		return 0;
 	}
+	fr_enable_dumpable();
 #endif
 
 #ifdef HAVE_SETUID
@@ -691,18 +710,6 @@ static int switch_users(CONF_SECTION *cs)
 		 */
 	} else if ((debug_flag == 0) && allow_core_dumps && doing_setuid) {
 		/*
-		 *	Set the dumpable flag.
-		 */
-#ifdef HAVE_SYS_PRCTL_H
-#ifdef PR_SET_DUMPABLE
-		if (prctl(PR_SET_DUMPABLE, 1) < 0) {
-			radlog(L_ERR,"Cannot enable core dumps: prctl(PR_SET_DUMPABLE) failed: '%s'",
-			       strerror(errno));
-		}
-#endif
-#endif
-
-		/*
 		 *	Reset the core dump limits again, just to
 		 *	double check that they haven't changed.
 		 */
