Search code examples
passwordsstdingogetpasswd

getpasswd functionality in Go?


Situation:

I want to get a password entry from the stdin console - without echoing what the user types. Is there something comparable to getpasswd functionality in Go?

What I tried:

I tried using syscall.Read, but it echoes what is typed.


Solution

  • you can do this by execing stty -echo to turn off echo and then stty echo after reading in the password to turn it back on