I have a bash script that opens various random files that could be anything (PDF, xlsx, MKV, MP4, WebM, html). Since I don't fully trust the source of these files, there is a chance that some of them could be infected with some kind of malware or malicious script, so I want to isolate the process that is handling with it.

I tested firejail and chroot, but I would like to know if there is something more secure to use.

What could be a good option to deal with this?

  • Do you want to isolate the script or the files it opens?
    – schroeder
    Jul 5 at 13:14
  • Your question made me rethink my question. My goal is to isolate the script while it is dealing with the files, for some files the script will convert to it another format, which implies "open" it. I'm not sure if there is a way to isolate the file while it happens, but if it can be possible, could be an approach.
    – Arrow Root
    Jul 5 at 14:53
  • 2
    So, what risks are you imagining? Let's say a PDF has some malicious content. "Opening" it with a bash script isn't likely to do anything. Exploits in files are designed to leverage vulnerabilities in the program typically used to open it. Files don't do much on their own.
    – schroeder
    Jul 5 at 14:59


You must log in to answer this question.

Browse other questions tagged .