I am trying to run a program compiled from C code from an unknown source. I want to make sure that the program does not harm my system in anyway. Like for instance, the pro
Check out seccomp. It was designed for this use case.
Create an user that has write access only to non-critical directories. Run the program as that user. If you are also interested in privacy, consider also restricting its read rights.
You can use something like schroot and chroot the program, but anything of sufficient nastiness will bust out of that.
You best bet is probably a virtual machine (vmware or virtualbox) and taking a snapshot before compiling and running the program. That way you can roll back if something goes horribly wrong.
The wikipedia page for chroot may be a good start. It describes chroot and also provides links to a few, more thorough alternatives.
chroot
is one possibility if you want to isolate it from everything else but still have an environment for it to run in.
http://en.wikipedia.org/wiki/chroot
https://help.ubuntu.com/community/BasicChroot
In addition of other answers, using strace
or ltrace
may help you to understand what the program is doing.