Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Setting user password to invalid one?

I'd like to create a "system" user using command line and set its password to such that cannot be typed in.


I found multiple pointers about using "dscl" and manage to create a hidden user, but I'd like to make it impossible to login to the user no matter what.


I already set it as a "Hidden" user, but this only hides him from the login screen, not from ssh, is it?


The motivation is that this is a "System" account (specifically, I intend it solely to own the Homebrew command) which should never, ever be logged in to.


In Linux(/Unix) there is the option to simply set the password in the /etc/shadow file to something that's not a possible output of the password hash (e.g. the literal "*" or "!"), therefore making it impossible to type any string which will let the user in.


Is this possible through command line on OS X (El Capitan)?

OS X El Capitan (10.11)

Posted on Mar 17, 2016 6:37 PM

Reply
5 replies

Mar 17, 2016 9:12 PM in response to BobHarris

Thanks but these won't do:


1. vipw edits a file which is only consulted in single-user mode (according to the comment at the top of the file - /etc/master.passwd).

2. The file vipw edits does not contain the password hashes

3. Even with a random password the account is still theoretically exposed to brute-force attack.

Mar 18, 2016 6:24 AM in response to syamos

Update: Apparently Linc and I were responding at about the same time, and Linc has a better answer.


A sufficiently long key will be next to impossible to brute force crack

You could see if you can figure out how the 'root' account is disabled for normal logins, but still exists.

dcsl . -read /Users/root

vs

dscl . -read /Users/

Then see if you can find something via Google about dscl that will explain how the 'root' account is disabled for normal logins.


Mar 18, 2016 6:32 AM in response to syamos

Filling in a few details to Linc Davis' post.


Directory Utility is buried in in coreservices. The easiest way to launch it is via Spotlight Command-Space "Directory Utility"

You unlock the padlock on the lower left

Select "Directory Editor" tab

search for the account to give invalid password

Select the Password field

In the bottom right box, enter the * as suggested by Linc

Click save


Test test test this on an account you can throw away if something goes wrong before applying it to an account you have spent a lot of time getting just right.

Setting user password to invalid one?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.