On a Linux box I want to run a Python script as another user.
I've already made a wrapper program in C++ that calls the script, since I've realized that the ownership of running the script is decided by the ownership of the python interpreter. After that I change the C++ program to a different user and run the C++ program.
This setup doesn't seem to be working. Any ideas?
Use the command sudo.
In order to run a program as a user, the system must "authenticate" that user.
Obviously, root can run any program as any user, and any user can su to another user with a password.
The program sudo can be configured to allow a group of users to sudo a particular command as a particular user.
For example, you could create a group scriptUsers and a user scriptRun.  Then, configure sudo to let any user in scriptUsers become scriptRun ONLY to run your script.
Running python script as another user