.py fails when not executed as a root

Hello, when i launch python script using “python3 script.py” as a root, it works, but not when i launch it as a non-root user. Do you have experience with this on how to allow particular Linux (debian) user to have enough permissions to launch it?

I think that in my case /usr/bin/python3 links to /usr/bin/python3.7 and so when i changed this file permission: sudo chmod u+s /usr/bin/python3
(means to SETUID)
it set the destination file (python3.7) permissions like this:
Access: (4777/-rwsrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
then i can launch python script as non root user without problem. it also works with 4751 permissions and i do not know if 777 is default and proper python permission. Also i do not know how bad idea it is to SETUID in case of python and what is better approach to run .py script as not root without need of sudo.


Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki