Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In os X it's possible to have users without passwords. If you inspect them with dscl their password show up as *. This is used for system users such as users for databases like mysql, pgsql etc. What's nice about this is that these users doesn't show up at the login screen and you can't login as them without sudo etc.

After deleting such a user trying some things out I wanted to recreate it, but couldn't. I could manage to get a user with a blank password and I could set the password to *. But none had the same effect as above, as the user showed up on my login screen.

How do you create such a user?

share|improve this question
On Linux, you pass the --disabled-password flag to adduser. Maybe OS X has something similar in its command line repertoire? – B.R. Aug 10 '10 at 21:00
Did you mean; user can log in without a password or can't log in at all because no password is set? – Chris Huang-Leaver Aug 10 '10 at 21:08
I notice you didn't accept an answer... one requirement to stay out of the various xdm lists is having a significantly low userid. on many systems useradd starts adding id's at 1000, and the login managers won't show user id's below that, but everything above. so though it's not an answer to this question, it might be the resolution to the problem. please note that 1000 is arbitrary and may be lower or higher on your distribution. To fix just modify the user entry in /etc/passwd to have a lower uid. Now for me to go ask similar question. – xenoterracide Apr 7 '11 at 19:53
@xenoterracide: When I recreated the user, I gave it the old ID, it was the pgsql user I deleted which has an id of one higher than the mysql one, so I'm sure it didn't have any impact in this case, but thanks for the info anyways. – googletorp Apr 7 '11 at 21:16

You can run passwd --delete <username> after creating the user with adduser. After this, you'll be able to login without entering a password.

share|improve this answer
I think that's the exact opposite of what is being asked for here. – Shadur Nov 29 '11 at 13:37
At first, I thought this was the right (or best) answer, until I've re-read the OP's question, which mentions for "system user" and not show up on "login screen". This method will show up on login screen and you can 'sudo' using this method. – HidekiAI Apr 28 '15 at 23:30

A user in /etc/passwd with home directory of /dev/null and shell of /sbin/nologin, can be used for sudo ing commands, but can't actually be logged into, for example;

from my /etc/passwd

tcpdump:x:104:441:added by portage for tcpdump:/dev/null:/sbin/nologin

I half remember this will make it disappear from the XDM login screen too, but I don't use XDM anymore, so that's a guess :-)

share|improve this answer
This is the right answer because the OP asked for account which you cannot 'sudo' or show up on "login screen", by setting to '/sbin/nologin' for shell. One thing to note is because the OP asked for "system user", should also mention that 'useradd --system' should be used to create UID in low number (as portage/ebuild does) – HidekiAI Apr 28 '15 at 23:26

I can't be certain about OSX, but on FreeBSD you can use:

pw add user mymuser -g mygroup -s /nonexistent -h -

the value of - passed to the -h option tells pw to set the password field in master.passwd to *, thus creating a no-login account. Setting the shell isn't strictly necessary, but avoids a shell check from /etc/pw.conf.

share|improve this answer

Leaving the password field empty for the user in the passwd file will work.

share|improve this answer

If you are on Ubuntu you can swap in the password for the Ubuntu user in /etc/shadow check out this article:


share|improve this answer

You can use usermod, which will disable the password using an ! rather than an *.

usermod -L <username>

From the man page on usermod:

-L, --lock Lock a user's password. This puts a '!' in front of the encrypted password, effectively disabling the password.
share|improve this answer

Using dscl would give

dscl . -passwd /Users/myuser ""
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.