I noticed some strange behavior with Windows Command Prompt while using SSH to connect to a remote Linux server and was wondering if there is an explanation.
I am designing a database on a remote Linux server for company use. Depending on what I am doing, it is sometimes more convenient to edit database-related files by opening Command Prompt, connecting to the remote server, and editing files with commands such as:
PS C:Users[username]> ssh [user]@[remote computer name]
Welcome to Ubuntu 26.04 LTS (GNU/Linux 7.0.0-27-generic x86_64)
* Documentation: https://docs.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
...
[user]@techadmin-Virtual-Machine:~$ sudo nano /var/www/html/add_raw_material.php
[sudo: authenticate] Password:
Something strange happens when I have Num Lock enabled and enter numbers using the numeric keypad at this password prompt. With Num Lock on, pressing any digit except 0, 3, or 9 causes three characters to be entered. Pressing 0, 3, or 9 causes four characters to be entered.
All characters displayed in the password prompt appear as “*”, so I cannot see what is actually being entered. I can copy the contents, but pasting only produces a series of asterisks regardless of what I typed.
With Num Lock enabled, pressing keys on the numeric keypad does not cause any characters to appear in the normal Command Prompt (when not connected through SSH). It also does not happen when I am SSH-connected and entering commands normally; it only occurs at this Linux sudo password prompt.
Additionally, when I connect directly to the Linux desktop through a remote desktop session, typing numbers with Num Lock enabled behaves normally.
What is causing these extra characters to appear, and what exactly are they?
(I’m on Windows 11, Ubuntu 26.04 LTS (GNU/Linux 7.0.0-27-generic x86_64).)
EDIT: When I type cat -v into CMD (again connected via SSH to the remote server, entering each digit 0-9 with Num Lock on causes the following series of characters to appear:
0:
^[[2~
1:
^[[F
2:
^[[B
3:
^[[6~
4:
^[[D
5:
^[[E
6:
^[[C
7:
^[[H
8:
^[[A
9:
^[[5~
I’m assuming these are the characters (probably without the opening ^ to make the number of characters here match the number appearing in the prompt) that are appearing behind the scenes in the password prompt, but what in the world do they signify?