3 ms·
This is a good point, and I should have been more precise in my original comment :-) If the program is on a TTY, then reading with echo disabled (i.e., `read -
by woodruffw 6y ago
This is a good point, and I should have been more precise in my original comment :-)
If the program is on a TTY, then reading with echo disabled (i.e., `read -s`) is definitely preferable. I usually have stdin configured as a fallback for when the program isn't on a TTY, for programmatic use.
This has the `echo` problem that you mentioned, but it's strictly better than either argv or the environment (both of which persist throughout the program's lifetime and appear in places like procfs).
- dharmab 6y agoFor programmatic use a file or system keychain is safer than stdin.
- woodruffw 6y agoAgreed re: the file. For the system keychain, I think we're talking about different use cases, no? The system keychain should be used to store the master password, but using it to pre-store any password you intend to later store in another password manager feels a little silly.