Win*_*nix 6 command-line sudo password
对于大多数应用程序,当您键入密码时,*会出现星号或星号 ( ) 来指示您键入的每个键。但是,当您键入sudo并提示您输入密码时,您键入时不会显示任何内容。
输入sudo密码时如何让星星出现?
在sudo终端输入后,如果您希望星号/星号与您键入的每个密码字符一起出现,您需要使用以下命令进行配置:
sudo visudo
Run Code Online (Sandbox Code Playgroud)
找到包含该行env_reset并在其, pwfeedback后面添加参数的行。下面是一个例子:
GNU nano 2.5.3 File: /etc/sudoers.tmp Modified
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset, timestamp_timeout=120, pwfeedback
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
^G Get Help ^O Write Out ^W Where Is ^K Cut Text ^J Justify ^C Cur Pos ^Y Prev Page
^X Exit ^R Read File ^\ Replace ^U Uncut Text ^T To Spell ^_ Go To Line ^V Next Page
Run Code Online (Sandbox Code Playgroud)
进行更改后,使用Ctrl+保存文件O以写入文件。系统将提示您输入文件名,但只需按Enter即可接受默认值。保存后,使用Ctrl+退出编辑器X。
同样在此示例中,超时值已设置为 120 分钟(2 小时),因此不会sudo每 15 分钟不断提示您输入密码。如果您愿意,可以忽略此选项,也可以根据需要增加/减少它。