Reset your lost password using Docker and SSH

Alex Ellis
4 min readJul 19, 2020

We’ve all been there. You turn on a machine in your home-lab, your Raspberry Pi, or an old PC and you’ve forgotten your password. At this point you start Googling, and that might be what brought you here.

Disclaimer

The other options that you find to do this may be a little clunky, but if you have your SSH key installed on the remote machine, and Docker, you can reset your password in a few simple commands. It’s not particularly novel, or ground-breaking, but this may be useful to you at some point as it was to me today.

I bought this C30 bargain Xeon workstation on eBay in 2019

Pre-reqs:

  • Docker already installed on the machine
  • SSH access with your public key in the authorized_keys file

I ran into this combination today, when booting up my Lenovo C30 workstation, running Ubuntu 16.04 and a version of Docker. It was a development machine with some code on it that I needed.

I tried all my passwords and none of them worked, but I did have ssh access, and once inside, I couldn’t run sudo because I didn’t have my password.

Find the host’s IP

First, shell into the machine. You will need the remote IP address of the host, and if you are not sure of it, you can use nmap to scan your local home network to…

--

--