Drop daemon privilegies

Souf souf_oued at yahoo.fr
Thu Nov 24 19:00:37 UTC 2011


There is an example in httpd:

#if ENABLE_FEATURE_HTTPD_SETUID
		/* drop privileges */
		if (opt & OPT_SETUID) {
			if (ugid.gid != (gid_t)-1) {
				if (setgroups(1, &ugid.gid) == -1)
					bb_perror_msg_and_die("setgroups");
				xsetgid(ugid.gid);
			}
			xsetuid(ugid.uid);
		}
#endif






More information about the busybox mailing list