Have script run as a different user

Hi all,
I'm a newbie to the Linux world.

I have a script that needs to run under "UserB". But I don't want to give out the password to UserB. Is there a way to setup the script to run as "UserB" when UserA runs it.

Thanks in advance for your assistance.

Try installing "sudo" and you can run it as:
sudo su - userB -c scriptB