Written 6 Sep 2026. This is a how-to, not a product card.
When you forgot the computer's login password
SSH and the keyboard both reject the password. Boot recovery or the installer USB, remount the disk, set a new one. Skip wiping the whole PC if the files are fine.
Still guessing while SSH works? Change it while logged in: change the login password. Router gateway form? That is when the router password won't work. House share login? Clear the saved one with forget the saved house-share login, or set Samba with set or change the house-share password. Pi-hole admin is separate: change the Pi-hole admin password. This note is only the Linux user password on the old PC — the one SSH and the local keyboard ask for.
Skip until it is really that password
Wrong address, soft-off, or "connection refused" is when SSH won't connect, not a forgotten password. If you turned password login off on purpose, a keyboard on the computer is the backup: turn off password login once the key works. Don't wipe the disk because Caps Lock was on.
What this is
Ubuntu Server and Debian keep a normal user you made at install. That password unlocks SSH until you move to a key, and it unlocks a keyboard on the box. Forgetting it does not erase the house folder. You reset it from recovery or a live USB, then log in again. The files stay.
Step 1: rule out the cheap mistakes
Confirm the username. It is the account from install day, not root, not Administrator, not pi unless you named it that. Caps Lock off. Nothing shows as you type. That is normal. Try once more with the install-day password written down somewhere (password manager, notebook, sticky note you should not have left on the monitor).
If SSH says Permission denied (publickey) and never asks for a password, password login may already be off. Plug a keyboard and screen, or use recovery below — a wrong password is not the problem until a password prompt appears.
Step 2: plug a keyboard and a screen
You need them for this job, even if the computer usually sits headless. Use the motherboard HDMI or DisplayPort, not a dead add-in card port. Power on. If you never see a login prompt, walk when the old PC won't boot first.
Step 3: prefer GRUB recovery when the menu appears
Reboot. At the maker logo, tap Esc (many UEFI boxes) or hold Shift (some BIOS installs) until the GRUB menu shows. Pick Advanced options, then the line that says recovery mode. In the recovery menu, pick root (Drop to root shell prompt). If it asks to remount, say yes, or run:
mount -o remount,rw /
Set a new password for your user (swap you):
passwd you
Type the new password twice. Nothing shows as you type. Then:
reboot
After it comes back, try the keyboard login, then SSH from the couch with the new password.
Step 4: if GRUB never appears, use the installer USB
Need a stick first? Make a boot USB, then boot the old PC from the USB stick. Prefer a live desktop ISO when you can (Ubuntu Desktop "Try Ubuntu", or Debian live). Open a terminal. List disks:
lsblk
Find the system disk (often the big SSD, not the USB stick). Mount the root partition. Example names vary — swap in yours from lsblk:
sudo mkdir -p /mnt/root
sudo mount /dev/sda2 /mnt/root
If /mnt/root/etc/passwd is missing, you mounted the wrong partition. Unmount and try another. When the tree looks right:
sudo mount --bind /dev /mnt/root/dev
sudo mount --bind /proc /mnt/root/proc
sudo mount --bind /sys /mnt/root/sys
sudo chroot /mnt/root
Forgot the username too? List home folders:
ls /home
Then:
passwd you
exit
sudo reboot
Remove the USB when the firmware asks, or open the one-time boot menu and pick the internal disk. Log in with the new password.
Step 5: prove SSH, then store the password
From the laptop on house Wi-Fi:
ssh you@that-address
Swap in your username and the computer's house address. Need that login walk? SSH from the couch. Keep a password manager entry labeled computer login (not Wi-Fi, not Pi-hole, not Samba). When password login has been boring for a week, add a key: log in with a key, not the password every time. Put a key on a second laptop before you turn passwords off: put a key on a second computer first.
What this is not
This is not a factory wipe. Wiping is wipe a Marketplace PC before you install when you want a clean OS on purpose. It is not the router, Pi-hole, or share password. It is not a reason to buy a KVM or a new mini PC because you forgot a string. It is not opening SSH to the public internet so you can "fix it later."
What next
Login works again? Store the password, then keep using SSH: SSH from the couch. Changing while already logged in next time: change the login password. SSH still fails for other reasons: when SSH won't connect. Share password is a different box: set or change the house-share password.
Optional: jot the username (not the password) in Lab plan — username + passkey, no email. Skip if you just want to keep reading.
Skip
- Skip wiping the disk because one password failed.
- Skip typing the Wi-Fi, router, Pi-hole, or Samba password into SSH.
- Skip buying a KVM, a new N100, or a password appliance for this.
- Skip opening port 22 on the public internet.
- Skip turning password login off until a second laptop key works.
- Skip this if SSH never reaches a password prompt. Use the SSH connect walk first.
Sources
Ubuntu: reset a lost administrative password. Debian: passwd. Ubuntu: passwd. Partition names and GRUB keys differ by machine; lsblk and the recovery menu are the map. Official pages only. For a password you can still type while logged in, see change the login password. For SSH errors that are not a forgotten password, see when SSH won't connect. For the first login walk, see SSH from the couch.