in reply to Program changing users

If you're feeling adventureous you can set the suid bit on the program (if you're on unix) but apparently it will not work everywhere because of security issues. I've never used it, because I can't figure out when it's safe to use.

The safest way appears to be to make a suid wrapper program in C (shouldn't be much work) and let that execute the script for you.

Option 2 is to use sudo or su -c:

sudo program options
if the user in question has sudo powers.

Anyway, 95% of the time you don't want all of this anyway, because if YOU can't write to a specific directory, you shouldn't be able to run a program that can. Except for the exceptions, ofcourse.