1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How to limit subprocess file permission with python

Discussão em 'Python' iniciado por Stack, Setembro 18, 2025.

  1. Stack

    Stack Membro Participativo

    Assume I have a black list about what non accessible directories

    no_access_path=os.environ.get("NO_ACCESS_PATH").split(';') if os.environ.get("NO_ACCESS_PATH")


    I creat a subprocess:

    ## touch /tmp/not_access/test.gz
    no_access_path=['/tmp/not_access']
    proc = subprocess.Popen('ls /tmp/not_access')


    Expect output: raise error or return empty

    I've known that chroot seems to be able to meet this requirement in linux, but I can't implement it in python. Are there any solutions or open-source tools available?

    Continue reading...

Compartilhe esta Página