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

When I run whoami it says:

whoami: cannot find name for user id 0

My /etc/passwd file looks like this:

root::0:0:root:/root:/bin/bash
share|improve this question
    
Your /etc/passwd is broken? Can you post the contents – warl0ck Jan 31 '13 at 2:06
    
What's your id command in current shell when you get whoami?. – PersianGulf Jan 31 '13 at 3:16
7  
(1) Which linux distribution? (2) What is output of pwck and grpck? (3) Does file /etc/shadow exist? – John Siu Jan 31 '13 at 4:34
5  
Also, have you set up (or attempted to) directory services of some sort (LDAP, NIS, etc.)? Have you touched /etc/nsswitch.conf? – derobert Jan 31 '13 at 17:09
1  
I'm thinking nsswitch.conf as derobert mentioned. But I have seen nscd cause weird crap like this before. If it's running, try stopping it. If it is not running, try starting it (though the starting it if it's not running thing was an old RHEL bug that should not around any more). – Patrick Feb 1 '13 at 3:35

Notice there is a missing x

This is the content of mine on Linux Mint with kernel 3.8.0-35-generic

root:x:0:0:root:/root:/bin/zsh

The x means that the actual password information is being stored in a separate shadow password file, tipically /etc/shadow

https://en.wikipedia.org/wiki/Passwd

share|improve this answer

I would recommend checking the permissions on /etc/passwd and /etc/group. If they're not set to 644 (-rw-r--r--), then run:

chmod 644 /etc/passwd; chmod 644 /etc/group

share|improve this answer
    
still says cannot find name for user id 0 – gabemai Jan 31 '13 at 22:28

Check that each and every line in /etc/passwd has exactly seven fields.

share|improve this answer

I know it's right on time, but the reason could be coreutils compiled without ACL support. Check it and rebuild the package if needed

share|improve this answer

Your Answer

 
discard

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.