0

I've flashed Ubuntu 16.04 LTS onto an SD card, enabled SSH by adding the empty ssh file at the system root, and then SSH'ed into the Raspberry Pi with the username ubuntu:

❯ ~ [22s] ssh ubuntu@192.168.1.97
Last login: Fri Nov 27 18:16:13 2020 from 192.168.2.196
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for ubuntu.
Current password: ubuntu
New password: SNIP
Retype new password: SNIP
passwd: password updated successfully
Shared connection to 192.168.1.97 closed.

However, after filling out the enforced change-password prompt, the SSH connection is closed … and then attempting to SSH in again, with the new password, yields the same prompt:

❯ ~ [7s] ssh ubuntu@192.168.1.97
Last login: Fri Nov 27 18:16:21 2020 from 192.168.2.196
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for ubuntu.
Current password: SNIP
...

How can I disable this, or otherwise escape the infinite password-changing loop, to get into the system? I've tried wiping the SD-card and re-flashing a fresh copy, with the same results. Have also tried the newer, non-LTS Ubuntu Server 20.10, with the same results.

1
  • Read man chage shadow. You'll have to fix /etc/shadow very carefully. – waltinator Nov 27 '20 at 23:28
1

I think you either you need to:

  1. Mount the "disk" from another Linux machine, and change the password from there. You should be able to pull it off with a copy of busybox from the host platform, copied into the disk, and then chrooting to the disk using the busybox for both a shell and the passwd command.

  2. Attach a keyboard and monitor, and login normally. While the password update might be broken in ssh, it should work on a console login.

  3. Mount the "disk" from another Linux machine, and otherwise edit /etc/shadow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.