How do I determine if a user has a password set on Mac?
Asked Answered
N

2

5

I need to determine if a user has a non-empty password set on Mac. Anything will work: a command line call, AppleScript, Carbon, Cocoa, etc.

I want to inform the user whether or not they have a password set.

Nihility answered 16/8, 2011 at 16:17 Comment(3)
every user has a password set.Shrill
You can create an account with an empty password... but then you have to supply an empty password when you authenticate.Calesta
I know every user has a password set. I've edited my original question to clarify what I thought was obvious. I'm looking to determine if a user has a non-empty password set.Nihility
N
9

I've found the answer to my question. Thanks anyway.

dscl . -authonly <username> ""
Nihility answered 16/8, 2011 at 19:34 Comment(0)
E
0

If you are performing an action that would require any user to enter a password, then you should allow them the opportunity to verify that password even if it is empty, and then handle the behavior if they decide not to allow that action accordingly.

Elfredaelfrida answered 16/8, 2011 at 19:1 Comment(4)
I agree. However, what I am doing does not require a password. I don't want them to enter a password at all. All I need to do is detect whether a non-empty password is set or not.Nihility
Then what do you care about the password if you don't need it to do what you want? What are you trying to accomplish?Elfredaelfrida
I want to notify the user that their password is not set, that's all.Nihility
You need to add that information to your question, because as it stands now it doesn't make any sense.Elfredaelfrida

© 2022 - 2024 — McMap. All rights reserved.