What is the safest way to run an executable on Lin

2020-01-31 03:26发布

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 program might have soemthing like system("rm -rf /") in the source, which is un-detectable, unless the code is thoroughly examined.

I thought of the following 2 ways

  1. Run it inside a VM like VMWare
  2. Build a windows exe on linux and run on wine

Both are not very elegant solutions and I cannot automate them. and also, in case of 1, it can harm the VM.

Any help would be appreciated.

I want to run the program in what we can call a "sandbox".

9条回答
对你真心纯属浪费
2楼-- · 2020-01-31 04:17

The wikipedia page for chroot may be a good start. It describes chroot and also provides links to a few, more thorough alternatives.

查看更多
狗以群分
3楼-- · 2020-01-31 04:21

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.

查看更多
The star\"
4楼-- · 2020-01-31 04:21

In addition of other answers, using strace or ltrace may help you to understand what the program is doing.

查看更多
登录 后发表回答