为什么波浪号 V 输出 ~V [LogLevel ERROR]?

为什么波浪号 V 输出 ~V [LogLevel ERROR]?

我使用的 GitHub 帐户的密码变体之一包含字符~V。当提示输入推送到 Github 的密码时,我输入了~V,然后输出

~V [LogLevel ERROR]

为什么是这样?

答案1

我认为您正在使用 SSH 会话。SSH 允许您使用某些“转义”序列向 SSH 本身(而不是您登录的 shell)发送特殊命令。从man ssh

ESCAPE CHARACTERS
 When a pseudo-terminal has been requested, ssh supports a number of
 functions through the use of an escape character.

 A single tilde character can be sent as ~~ or by following the tilde by a
 character other than those described below.  The escape character must
 always follow a newline to be interpreted as special.  The escape
 character can be changed in configuration files using the EscapeChar
 configuration directive or on the command line by the -e option.

 The supported escapes (assuming the default ‘~’) are:
 ...

 ~V      Decrease the verbosity (LogLevel) when errors are being written
         to stderr.

 ~v      Increase the verbosity (LogLevel) when errors are being written
         to stderr.

因此,如果您按下Enter用户名提示,那么~V作为密码的前两个字符,SSH 会将其解释为增加日志详细程度的命令。

因此,通过 SSH,要输入~V密码的前两个字符,可以:

  1. ~两次,以便将其视为文字~(根据上面引用的第二段):~~V,或
  2. 在提示开始时执行某些操作来中断序列(例如,键入一个字符并将其删除)。

相关内容