In one of the machines I work with I'm seeing a strange behaviour. I've manually changed the shell of one user in /etc/passwd but when I try to login with that user, it still uses the old one. getent also shows the old one. But a grep on the /etc/passwd file confirms I saved the file correctly.

Is there (on Linux) any kind of /etc/passwd caching?

How to avoid it?

  • Whats the output of grep <that_user> /etc/passwd? – heemayl Jan 18 '17 at 8:40
  • The output of a grep is a correct line with the new shell I put by hand – Envite Jan 18 '17 at 8:44
  • 4
    you should have used chsh <username>... – 13dimitar Jan 18 '17 at 8:45
  • Consider posting the output here, and mask if there are any private stuffs present. – heemayl Jan 18 '17 at 8:46
  • 4
    This information could be stored in your company LDAP/AD, in particular, if the machine is set up to authenticate against LDAP/AD anyway. – Ulrich Schwarz Jan 18 '17 at 9:54

Do you have a process named nscd running? That's the name service caching daemon.

If it is running, you may need to run sudo nscd -i passwd to tell it that it should forget any cached /etc/passwd file data. It has other caches too: the respective keywords for them are group, hosts, services and netgroup.

It is more commonly used with LDAP/AD/NIS-based authentication schemes, but may improve system performance if you're running some process that makes a very large number of user/group/service/hosts-file look-ups. Or if you have installed some services you're not actually using (perhaps to use just a small part of them), some service may have pulled nscd in as a dependency.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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