Why can't I echo the password to fetchmail?
The reason for the given error message is that fetchmail has its standard input not attached to a terminal, but a pipe.
man fetchmail | less -Ip 'user authentication step failed'
# from:
# http://opensource.apple.com/source/fetchmail/fetchmail-33/fetchmail/fetchmail.c
...
if (!isatty(0)) // <-- tests if stdin is a terminal (added)
{
fprintf(stderr,
GT_("fetchmail: can't find a password for %s@%s.\n"),
ctl->remotename, ctl->server.pollname);
return(PS_AUTHFAIL);
} else {
...
You may, however, try the following script
hack to let fetchmail
run in a pseudo terminal.
(sleep 0.3; echo "dohadeer") |
( script -q /dev/null fetchmail --all -p pop3 -k pop.gmail.com --ssl -d0 --user [email protected] )
Intentional. Anything on the command line can be seen by anyone else on the system by executing a simple ps
command, so most software that takes a password will not accept the password piped from the command line.
There are some tricks you can do with wish
and expect
but you're looking for less complexity, not more...
You can use the .netrc
file to specifiy passwords; this is explained in the manual http://www.fetchmail.info/fetchmail-man.html#14. Example:
machine hermes.example.org
login joe
password topsecret