How can I mask input from the command line? Basic use case: I want to enter a password when prompted, and I need to either see *’s or nothing at all.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since you can call Java libraries from Groovy, you may find your answer in the question How to mask a password in Java 5?.
In short, use
Console.readPassword()(Java 6 or later).