I want to run a command with a specific users permission in a Python script.
import os
os.subprocess("sudo su user; cd <directory_path> ; touch test", shell=True)
The test file here is not created with the ownership of the user I use with sudo su.
I also tried the same command with sudo -u and sudo -i but it didn't work.