Ubuntu – How to reset administrative password without the use of a “p” key.

keyboardkeyboard-layoutpassword-recoveryreboot

So I do not know my administrative password. I read up on how to reset it by clicking left shift after the BIOS page upon start up. going to the recovery option, then root, then doing mount -o rw, remount / but then I believe I must do passwrd to change the password, HOWEVER, my keyboard does not have a working "p" key.

Does any one know of an alternative way to reset the administrative password without the use of a 'p' key? If not, does anybody know of a clever way to utilize the letter 'p' in the command prompt without a working key?

Or perhaps anyone might know how to find out your password without having to change it at all? Thank you for your time.

Best Answer

$'\x70'asswd

will mean passwd in bash, because $'x70' means p. See here for more info on this feature.

ASCII table here or in man ascii, you need the hex value for the character, for p it is 70 so you produce it with $'x70' .


Or if you already installed zsh and have turned on the interactive menu completion then from a zsh shell you can cd /usr/bin/. And then type ./ and press TAB and keep it pressing/pressed until the interactive menu completion kicks in and then just select passwd with the cursor keys.

Or if you have mc (Midnight Commander) installed you can use that to select /usr/bin/passwd and then press ENTER on it to launch it or ALT+ENTER to copy the selected filename to the command line. (In this case you will likely need the latter as you will have to supply the username also to the command line because you are not changing the root's password but some user's. So simply launching passwd is not want you want.)

Or any similar interactive selection program should work, but obviously these should be already installed on your system as now you don't have access to the admin password so you can't install anything.


Or if you have only passwd in /usr/bin/ which has only one letter before asswd (on a default setup this is true) then of course you can just use bash's globbing features and simply type:

/usr/bin/?asswd

to launch passwd.

Related Question