My laptop's keyboard is failing and certain keys sometimes work, and sometimes don't. When I type a password on a GUI, I realize that the pressed key has not worked, since I can count the keystrokes looking at something akin to ****** in the password field. That gives me the chance of re-pressing the key, until it works (which can mean between 1-3 presses). The same applies to typing a normal text.

When typing my password in the command-line (using su, for example), however, I only realize that some key has not worked after I press enter and get a Authentication failure message.

Is there a safe way of dealing with it? Just typing the password in plain text and copy-and-pasting it seems not to be the case.

  • 1
    You cannot show asterisks with su.
    – jimmij
    Jan 10, 2018 at 13:36
  • Replace or fix the keyboard instead of making your system insecure.
    – Kusalananda
    Jan 10, 2018 at 13:49
  • If ever a question was being asked for the wrong reasons. My car ran out of gas...can someone tell me how to convert the engine to run on battery power? Fix the keyboard! ;)
    – B Layer
    Jan 10, 2018 at 14:10
  • I used the solution linked by Heinzi for your exact purposes, it works nicely. Dec 2, 2021 at 9:54

2 Answers 2


You could set up sudo and use it instead of su.

sudo allows you to set the pwfeedback option, which will do what you want.


No, probably not. The program would have to be modified to output the dots or asterisks on each keypress. That's extra code (it's much easier to just disable echo). Some consider it an abomination, since it makes the length of the password visible so I wouldn't put much money on patches being accepted either.

Typing the password locally on the laptop might not be that dangerous though, since if your laptop is compromised, a keylogger is probably the first thing installed, and the attacker will get your password anyway, when you type it to SSH. Not that typing the password so that it's visible on screen in plain text would be wise, though.

Have you considered using a password manager? They usually work by letting you paste the password to the application that needs it, so you only need to type the manager's master password, and a password manager with GUI might show the dots.

Another possibility would be change all your passwords so that they don't need any of the broken keys. This shouldn't be too bad if only a few keys are stuck, and if you compensate for it by making the password slightly longer.

In any case, working with a broken keyboard will likely become horridly annoying eventually even for other reasons, so I would look into getting it cleaned / fixed / replaced.

  • It can be done, see the solution linked by Heinzi. Dec 2, 2021 at 9:55
  • @sancho.sReinstateMonicaCellio yep, specific to the application. You'd need the same for any other program that asks for passwords, e.g. ssh. I would still just fix the keyboard.
    – ilkkachu
    Dec 2, 2021 at 13:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .