# whoami: cant find username for uid 1000, everyday user brokn

## jeffk

Like many people new to gentoo, I have one everyday user in addition to root. Somewhere along the install and update cycle, I make some etc-update decision that messed up my everyday user account.

When logging in as myuser, I get the following warning:

```
/usr/bin/whoami: cannot find username for uid 1000

-bash: [: =: unary operator expected

I have no name!@myhost#
```

What info can I provide to help diagnose the problem? Here's a few pertinent greps:

```
 # grep myuser passwd

myuser:x:1000:100::/home/myuser:/bin/bash

# grep myuser group

wheel::10:root,myuser

audio::18:root,myuser

users::100:games,myuser

```

I would also like to have a group with the same myuser name, I got used to having that when I was on redhat. Thanks.

----------

## MatchboxOscar

Can you give us the contents of /etc/nsswitch.conf?

Also, you might issue:

getent passwd | grep myuser

Another file that might be of interest is /etc/pam.d/system-auth

----------

## jeffk

```
# /etc/nsswitch.conf:

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/nsswitch.conf,v 1.4 2002/11/18 19:39:22 azarah Exp $

 

passwd:      compat

shadow:      compat

group:       compat

 

# passwd:    db files nis

# shadow:    db files nis

# group:     db files nis

 

hosts:       files dns

networks:    files dns

 

services:    db files

protocols:   db files

rpc:         db files

ethers:      db files

netmasks:    files

netgroup:    files

bootparams:  files

 

automount:   files

aliases:     files
```

```
# getent passwd | grep myuser

myuser:x:1000:100::/home/myuser:/bin/bash
```

```
# cat /etc/pam.d/system-auth

#%PAM-1.0

auth       required     /lib/security/pam_env.so

auth       sufficient   /lib/security/pam_unix.so likeauth nullok

auth       required     /lib/security/pam_deny.so

 

account    required     /lib/security/pam_unix.so

 

password   required     /lib/security/pam_cracklib.so retry=3

password   sufficient   /lib/security/pam_unix.so nullok md5 shadow use_authtok

password   required     /lib/security/pam_deny.so

 

session    required     /lib/security/pam_limits.so

session    required     /lib/security/pam_unix.so

```

----------

## MatchboxOscar

Hmmmm.  What is the output of the command 'id'?

----------

## jeffk

```
myhost root # id

uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),18(audio),20(dialout),26(tape),27(video)

myhost root # id myuser

uid=1000(myuser) gid=100(users) groups=100(users),10(wheel),18(audio)

(as the broken user)

I have no name!@myhost# id

uid=1000 gid=100 groups=100,10,18
```

[/code]

----------

## MatchboxOscar

Is the whoami binary broken?  What happens if you issue whoami?

It is supposed to give you the exact same output as id -un

What are the permissions on /etc/passwd?

----------

## jeffk

 *MatchboxOscar wrote:*   

> Is the whoami binary broken?  What happens if you issue whoami?

 

I was mistaken about the output I quoted, I think. I userdel'd that user, and recreated it. Now logging in as 'myuser' I get:

```
I have no name!@myhost myuser $ whoami

whoami: cannot find username for UID 1000

I have no name!@myhost myuser $ id -un

id: cannot find name for user ID 1000

1000
```

 *MatchboxOscar wrote:*   

> What are the permissions on /etc/passwd?

 

```
root@myhost etc # ls -al passwd shadow group

-rw-------    1 root     root          713 Feb 15 20:06 group

-rw-------    1 root     root         1946 Feb 15 20:06 passwd

-rw-------    1 root     root          505 Feb 15 20:06 shadow
```

[/code]

----------

## tomk

My /etc/passwd and /etc/group have read permissions for group and other set. Try:

```
chmod 644 /etc/{passwd,group}
```

HTH

----------

