command su : enter directly

Hi, a simple question : How can I sent user and password to the command su.

I need this for a script, but the problem is the command su wait for the password.

Thanks.

Normally, password reading programs reset their STDIN filehandle in order to ensure input from a terminal. This has the advantage of preventing local brute force attacks at passwords.
An alternative is to install sudo (HP has precompiled binaries for 10.x and 11.x), and setup /etc/sudoers that the required program may be run by a certain user without a need for a password.
Another way might be to use expect to automatically input the password to su, but I advise against it, since saving passwords in clear text is always a bad idea.

If you are usera and you need to run a shell script or login to userb environment (and you have TCP/IP installed and working) remsh or rlogin to your local machine will often do the trick.

See
man .rhosts

First get written permission from userb and the System Administrator because this will allow usera full access to userb files.

In userb home directory , create a .rhosts file with permissions 600, owned by userb and userb's group, containing one line for the local server and usera. All entries are case-sensitive and must be accurate according to the rules.
The password does not appear anywhere.

This technique is not for secure environments and should never be used on a root account. It will fail if the password expires or the account is locked.