How Do I Hide the Password in a Script

Hi,

I am writing a UNIX .ksh script and need to send the login password of the login id that is executing the script to a command that I am executing in the script. I don't want that password to be seen by anyone except whoever is executing the script.

Does anyone know how I can accomplish this?

Thanks

SD

you can just get the encrypted password

Whats the command you are running in the script that needs a passwd?
Is it FTP?

It is a command that I am not sure is UNIX or home-grown. It is "become" which lets a user become another user (like su). In my script I have a line:
>become userid

I need to send the become command the user id of the user who is executing the script because, when run on the command line, the "become" command prompts for the user's password who is running the script.

SD

funksen, is there a way to pass that encrypted password to the command in my script?

SD

If the become command just reads from stdin, then all you have to do is something like this:

crypt key < /path/to/file/with/encrypted_passwd | become username

But if the become command is going to behave like passwd does, then I don't think it will be possible.

I don't think so, the command expects the password in cleartext and not the encrypted password

in your case I would rather use sudo and specify the "su" command for use without a password