Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
whoami: cant find username for uid 1000, everyday user brokn
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
jeffk
l33t
l33t


Joined: 13 Sep 2003
Posts: 671

PostPosted: Sun Feb 15, 2004 4:55 pm    Post subject: whoami: cant find username for uid 1000, everyday user brokn Reply with quote

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:
Code:
/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:
Code:
 # 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.
Back to top
View user's profile Send private message
MatchboxOscar
n00b
n00b


Joined: 15 Feb 2004
Posts: 24

PostPosted: Sun Feb 15, 2004 6:10 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
jeffk
l33t
l33t


Joined: 13 Sep 2003
Posts: 671

PostPosted: Sun Feb 15, 2004 7:02 pm    Post subject: Reply with quote

Code:
# /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


Code:
# getent passwd | grep myuser
myuser:x:1000:100::/home/myuser:/bin/bash

Code:
# 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
Back to top
View user's profile Send private message
MatchboxOscar
n00b
n00b


Joined: 15 Feb 2004
Posts: 24

PostPosted: Sun Feb 15, 2004 7:16 pm    Post subject: Reply with quote

Hmmmm. What is the output of the command 'id'?
Back to top
View user's profile Send private message
jeffk
l33t
l33t


Joined: 13 Sep 2003
Posts: 671

PostPosted: Sun Feb 15, 2004 7:24 pm    Post subject: Reply with quote

Code:
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]
Back to top
View user's profile Send private message
MatchboxOscar
n00b
n00b


Joined: 15 Feb 2004
Posts: 24

PostPosted: Sun Feb 15, 2004 8:38 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
jeffk
l33t
l33t


Joined: 13 Sep 2003
Posts: 671

PostPosted: Mon Feb 16, 2004 3:34 am    Post subject: Reply with quote

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:
Code:
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?

Code:
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]
Back to top
View user's profile Send private message
tomk
Bodhisattva
Bodhisattva


Joined: 23 Sep 2003
Posts: 7221
Location: Sat in front of my computer

PostPosted: Mon Feb 16, 2004 9:50 am    Post subject: Reply with quote

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

Code:
chmod 644 /etc/{passwd,group}


HTH
_________________
Search | Read | Answer | Report | Strip
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum