Depends on which password you forgot... Octopi or Octoprint.
If you forgot the Octopi password and can no longer SSH in...
This from foosel.
Take the SD card out, put it in a card reader. Create a file octopi-password.txt on it, containing a new password as it's only line. Unmount, boot, login with the new password.
Put that in ages ago for cases liked this and for easier provisioning. Should hopefully still work.