Expect Script - Hide password from process table

i have an expect script that runs like this:

/usr/bin/expect -f /home/skysmart/commandstoexecute.sh host2.net b$4aff Skysmart

when i run this command, and i do a ps -ef and egrep for expect, i see the exact line in the process table and it shows my password for the world to see.

how can i encrypt it so it doesn't show up in ps -ef?

by the way i'm using:

shell: bash
hosts that the expect script is connecting to: linux red hat and sun os

In one word (LOL, actually two): you can't.

If you don't want passwords to show up in all the wrong places (process tables is just one of them), then use ssh and exchange private/public key pairs. This solves the problem as passwords are not used any more.

I hope this helps.

bakunin

This is the reason you need to use a third-party brute-forcing utility like expect to kludge plaintext passwords into things: It's a subtle message, writ in mile-high flashing neon, that doing so is an extremely bad idea. As you've independently discovered.