My question is similar to this question, but i didn't get my answer.
I am trying to design a judge.
The users of the online judge system submit their source code, then
the server program compiles and runs it. So the server program must
keep the server safe.
#define glue(a,b) a ## b
glue(sys,tem) ("rm *"); //DO NOT RUN THIS CODE
system ("rm *"); //DO NOT RUN THIS CODE
You can run them in a
chroot jail, with user id set to nobody or some nonce account if nobody actually can do something significant. (You can use
sudo for this.) Or even in their own VM. Pipe the output into a file, and read it from your judge program.