autopw -- cache and re-inject passwords into other programs
The autopw utility will cache passwords and re-inject them whenever the given command requires them. That is, if command prompts for a password, autopw will cache it and then provide that password the next time command asks for it.
autopw is frequently used to wrap commands invoking ssh(1) repeatedly to avoid having the user monitor the command and re-supply their password when other forms of automation are not possible.
autopw currently matches and distinguishes the following prompts:
In the latter examples, autopw will be affirmative instead of supplying a password.
The following examples illustrate common usage of this tool.
To invoke the command ‘foo.sh’ and have autopw cache and re-inject any passwords prompted for, run
autopw sh foo.sh
Since autopw must keep the password available in memory it is obviously advised against using this tool on shared hosts.
You should only invoke commands that you actually trust -- autopw will only respond to specific patterns, and any program that prompts one of the strings autopw is looking for will be supplied with the given password. This is particularly concerning when executing commands on a remote, possibly untrusted host.
autopw does not play very well with multiple levels of pseudo-terminals (screen sessions, ‘ssh -t’ etc.) and may at times print the cleartext password to the terminal.
autopw invokes perl(1) ’s ‘pack/unpack’ function for each password provided/injected. This can become a performance-impacting limitation.
expect(1) , perl(1)
The autopw utility was originally written at Yahoo! Inc. It not being terribly original or clever, there appeared a number of variations. This variant is bundled with the scanmaster(1) scripts for convenience.
Table of Contents