Linux User does not exist – weird problem and solution

by Vivek Gite on January 28, 2007 · 0 comments

Recently I received a support request as follows:
After adding a user using useradd command:
useradd -s /bin/false -d foo
passwd foo

Following error reported
user foo does not exist

However, after sometime user foo allowed to login. What is going on? Is my system hacked?

First I went through system password database located at /etc/passwd, /etc/shadow, /etc/group - there exists an entry for foo user.

After close investigation I found name service cache daemon (nscd). It is a daemon that provides a cache for the most common name service requests including caching of /etc/passwd file (thanks for top and lsof command for hint).

So the solution is to stop the nscd service add user and start nscd again. This time it worked.
# /etc/init.d/nscd stop
# useradd -s /bin/false -d bar
# passwd bar
# /etc/init.d/nscd start

Now bar is allowed to login immediately :).

Refer to nscd man page for detailed information (hint setup correct TTL to get rid of this problem and upgrade to latest version):
man nscd
man nscd.conf

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

We're here to help you make the most of sysadmin work. So, subscribe!

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 5 + 14 ?
Please leave these two fields as-is:
Are you a human being? Solve the simple math so we know that you are a human and not a bot.



Previous post:

Next post: