[Answer]-Django – How can you execute a process as a user other than the apache user

1πŸ‘

βœ…

I know my answer might not satisfy all of your needs and it’s not very fast to implement, but I was thinking that in your Django app you could send a Linux su - your_user command (which would set the correct Linux user based on the currently logged in Django user) using Python’s subprocess and then, still using subprocess, call the jobs/tasks which need to be executed.

Subprocess: https://docs.python.org/3.4/library/subprocess.html

EDIT: you can also have a look at Pexpect https://github.com/pexpect/pexpect

πŸ‘€mastazi

Leave a comment