automatic su

Hi all,
Suppose I have a script under user A, which calls a script under user B (this script should be run using user B). How can I change the user (along with supplying the password) automatically in the script (a command similar to su)?
Thank you in advance
Best Regards

hey,
if you are using C, there is a PAM (Pluggable Authentication Module) available for linux.
you can get more information here

http://www.kernel.org/pub/linux/libs/pam/

hope it helps
asif