Go的getpasswd功能? [英] getpasswd functionality in Go?

查看:243
本文介绍了Go的getpasswd功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望能够从stdin控制台输入密码,当然,不要回显用户输入的内容。



有没有什么比得上getpasswd Go的功能? (谷歌的Go语言)



我尝试使用syscall.Read,但它回应了输入的内容。 解决方案

你可以通过执行 stty -echo 关闭echo然后 stty echo 在读取密码后重新打开它。


Would like to be able to take password entry from the stdin console, but, of course, without echoing what the user types.

Is there something comparable to getpasswd functionality in Go? (Google's Go language)

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

解决方案

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

这篇关于Go的getpasswd功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆