I am running this small python script on both linux and Solaris as a not privileged user :
#!/usr/bin/python import os print \'uid,euid =\',
You could potentially use sudo to achieve what you want. It runs stuff as different users:
sudo -u otheruser command
Permissions are set by root using visudo. The setuid/setguid stuff doesn't appear to apply to scripts or the shell in linux, only compiled code.