Reset Mac user password via SSH

catalinapasswordssh

I have a local Mac machine with Catalina that I haven't used in a while. I have forgotten the GUI password for the account, but I still can SSH into it because of my public key being on that machine. I also can't remember if I had a root account setup/or it's password.

Is there a way that I can reset the GUI password without having to restart the machine and hence losing the current state as the preliminary step for going through Apple's recommended process? I can't create a new (admin) user either because I don't remember the password and hence can't escalate to sudo privileges.

Best Answer

This might still work? If you log in with SSH.

FSCK the drive for a sanity check.

/sbin/fsck -fy

Mount the drive so it is writeable.

/sbin/mount -uw /

Deleting this placeholder file that tells macOS that a user has already been setup.

rm /var/db/.AppleSetupDone

reboot. Make a new user, reset the password of the old account. Also, reset the login keychain in the old account.