What's a good way of running a shell script as a different user. I'm using Debian etch, and I know which user I want to impersonate.
If I was doing it manually, I would do:
su postgres
./backup_db.sh /tmp/test
exit
Since I want to automate the process, I need a way to run backup_db.sh as postgres (inheriting the environment, etc)
Thanks!