iMac in recovery mode, can’t install macOS no matter what I try

Solution 1:

I solved the problem! I looked up how to erase a computer when you plan to sell it, was able to do so in recovery mode by opening up the disk utility and selecting erase on the hard drive and setting it to the maximum security. This successfully removed the need for the previous owners password and was able to reinstall macOS as per normal from there!