1

I was wondering if I could view the macOS login password through shell without resetting the password.

I rebooted my Mac and did Cmd+S and went through some .plist files but couldn't find anything.

Can someone help me find my macOS password through shell without resetting it?

7
  • 6
    Passwords are hashed, the original password isn't stored anywhere. The only exception is if you've enabled automatic login, that password is saved.
    – Barmar
    Jul 5 at 14:05
  • @Barmar Is the password really saved for automatic login? That would be a really weird way to implement automatic login. Judging by the list of cases where automatic login doesn't work, it looks like it corresponds to cases where a password would be needed, i.e. it looks like automatic login does not store the password. Jul 5 at 19:04
  • @Gilles'SO-stopbeingevil' When I've enabled auto-login in the past, it asks for the password. I assumed it's saving it so it can supply it to the login program as if I'd entered it by hand. But maybe that's just a verification step and it works differently.
    – Barmar
    Jul 5 at 19:08
  • @Barmar It's asking because it asks whenever you make a change to the login data for the account. You're entering your password to give the permission to make the change. Jul 5 at 19:26
  • @Gilles'SO-stopbeingevil' If automatic login is on, it's saved (in obscured form) in order to auto-unlock the user's keychain (since that's encrypted based on their password). Jul 5 at 23:28

1 Answer 1

4

This is impossible, by design. The reason is that if someone manages to read some of your files, for example because they have temporary access to your computer, or because they got hold of a backup, they must not be able to find your password.

When your computer verifies your password, it doesn't just compare the password with a stored reference copy of the password. It first calculates a password hash, then compares the result with the stored reference hash. By design, a password hashing function only works one way: it's impossible to calculate the password from the hash. If you only know the hash, the best you can do is to guess the password and check your guess.

If you've forgotten your login password, and you haven't written it down anywhere, the only solution is to change it. (Despite what it often said, writing a password down can be a good idea — but it must be on paper, and the paper must be stored somewhere secure such as a bank safe, not a post-it note in view of your webcam.)

If you've partly forgotten your password (e.g. you remember that it's Iloveyou and a number but you don't remember the number — obviously this example is a bad password!), there are tools that can help you crack it. You need to obtain the password hash then assist the tool with everything you know about the password. That's only realistic if you almost remember the password.

If you've used the same password for something else, of course, it may be stored somewhere else. If you've used it for a service that you accessed from the Mac, it's probably in your keychain. Of course, if you can't get into the keychain because you've forgotten the password, that's again by design, sorry.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .