Он используетgetpass()
из библиотеки libc (, где она доступна ), которая описана в справочных страницах следующим образом:
The getpass() function opens /dev/tty (the controlling terminal of the process), outputs the string prompt, turns off echoing, reads one line (the "password"), restores the terminal state and closes /dev/tty again.