Unknown Admin Password on New/Used IMac 2011
In short, you don't.
That's the entire point of having a secure computer.

The long answer is you have to wipe the machine &amp; start over. Nothing on there belongs to you, not even the OS itself, &amp; you would have to provide the old owner's credentials for any updates.

See Apple KB - What to do before you sell, give away, or trade in your Mac

If you are no longer in touch with the previous owner, you'll have to start from step 6. Fortunately you can actually just start from there on an old Mac. On a new one, you would need to get the original owner to release it first.