Recognise Normal Sudo Password Behaviour Before Retyping Credentials
A sudo password prompt normally hides keystrokes without displaying stars. The terminal can look unchanged while still receiving input. Later, sudo may accept another permitted command without prompting because its security policy allows cached authentication for a period.
Read the prompt before responding
Confirm that the command you intentionally entered requires administrative privileges and that the prompt belongs to that command. Read which account's password is requested. Policies can vary, so do not assume every machine uses an identical authentication arrangement.
Enter the password once and press Enter. Do not paste it into a normal shell prompt to test whether the keyboard works; that could expose it in terminal output or command history. If authentication fails, check the account and keyboard input privately before trying again.
The sudoers documentation explains that password feedback is off by default. Changing that policy is unnecessary merely to prove that keystrokes are being received. A refusal stating that a command is not permitted is also different from an incorrect-password error: authenticating does not grant permission for every possible command.
Finish the privileged work deliberately
Complete only the reviewed administrative task and inspect its result. A later command running without another prompt does not mean that the desktop account has permanently become root; it may be using valid cached authentication under the configured policy.
When finished, sudo -k without a command invalidates the cached credentials for the current session under the usual sudoers arrangement. Other sessions may have separate records. The documented sudo -K operation removes all cached credentials for the user where that policy supports caching. Neither operation reverses changes or stops already-running privileged programs.
Close any deliberate root shell separately and lock the desktop when leaving it. The acceptance check is that the intended task completed, its privileged session is finished, and any cache reset was applied with its actual scope understood. Do not use a destructive command merely to test whether another password prompt appears.
Sources: Ubuntu documentation, Ubuntu documentation.