Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a application which takes a C++, C, or Java file as input, executes it, and displays the output to the client. What are the best measures that can be taken so that no security related issues occur in the server in which program is executed. For example, the C++ program can open an fstream and create a custom file on our server

I know some practices like:

  1. Running it as normal user
  2. Writing our own sandbox scripts which do not allow system calls, etc.

Which is the best way to do this?

share|improve this question
up vote 1 down vote accepted

Compile, then execute as a dedicated user in a chroot environment that contains only the necessary libraries.

share|improve this answer
will try this thanks :-) – harish.venkat Jan 14 '13 at 4:45

Run it on a decicated computer just for these tasks or in virtual.

share|improve this answer
dude i want to essentially protect the data in my application as well.I know I can create jailed environment inside my server and protect it or as you suggested run it on dedicated server but this protect the server from this application which leaves application to danger – harish.venkat Jan 13 '13 at 19:13

What about SELinux?

SELinux can potentially control which activities are allowed for each user, process and daemon, with very precise specifications

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.