bug-sh-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: command id does not show the right id


From: Konarek Gerhard
Subject: AW: command id does not show the right id
Date: Wed, 31 Mar 2004 11:08:05 +0200

THANK YOU VERY MUCH! YOUR DETAILED EXPLANATIONS HELP US A LOT (for we
migrate from UnixWare to Linux and we have to work through years of
scripts)!

Best regards,
Gerd


-----Ursprüngliche Nachricht-----
Von: address@hidden [mailto:address@hidden
Gesendet: Mittwoch, 31. März 2004 10:53
An: Konarek Gerhard
Cc: 'address@hidden'
Betreff: Re: command id does not show the right id


Konarek Gerhard wrote:
> We are working with duplicated IDs (useradd -o).

That is a very unusual situation.  Not strictly prohibited.  Nor even
wrong.  But you should know what you are doing in that case.  Better
to avoid duplicated user ids.

> Unfortunately some errors occur if we run some scripts.

Are any of those errors bugs in any of the GNU coreutils for which
this list is maintained?

> For the understanding:
> 2 userids with useradd -o, "oper1" and "root"

That is a very strange case.  Definitely not recommended.  If oper1 is
the same as root then you should just use root and avoid the alias.

> aodb01 login: root
> Password:
> You have old mail in /var/mail/root.
> Last login: Tue Mar 30 14:17:05 from AOCOM01-RZ
> aodb01:~ # id
> uid=0(oper1) gid=0(root) groups=0(root)

The root user is user id 0.  In unix and unix like operating systems
names do not really matter.  Only the number matters.  This is showing
that the user id number is 0 and so you are the superuser.  When you
logged in as root it searched the /etc/passwd file from top to bottom
looking for the root user and found it with a user id of 0.  It logged
you in with user id 0.

The system can also map the user id to a name.  It looks through the
/etc/passwd file from top to bottom and looks for the first match.  In
your case the first match for user id 0 is oper1.  That is extremely
unconventional.  But not strictly prohibited.  Normally you would only
have one user mapped to a user id especially for the root user.

> aodb01:~ # who
> root     pts/0    Mar 30 14:17 (AOCOM01-RZ)

The who command dumps the contents of the /var/run/utmp file which
logs what users logged in and to what terminal device.  The root user
logged in.  That is what this shows.

> aodb01:~ # whoami
> oper1

The whoami command maps the user id to a name.  It looks through the
/etc/passwd file from top to bottom and looks for the first match.  In
your case the first match for user id 0 is oper1.

> aodb01:~ # echo $LOGNAME
> root

The LOGNAME variable is set by the login program.  When you logged in
it recorded who you logged in as and stored this in an environment
variable.

Generally who you logged in as when you logged into the machine is not
very useful.  I recommend that you ignore it.

> aodb01:~ # id
> uid=0(oper1) gid=0(root) groups=0(root)

The root user is user id 0.  In unix and unix like operating systems
names do not really matter.  Only the number matters.  This is showing
that the user id number is 0 and so you are the superuser.  When you
logged in as root it searched the /etc/passwd file from top to bottom
looking for the root user and found it with a user id of 0.  It logged
you in with user id 0.

The system can also map the user id to a name.  It looks through the
/etc/passwd file from top to bottom and looks for the first match.  In
your case the first match for user id 0 is oper1.  That is extremely
unconventional.  But not strictly prohibited.  Normally you would only
have one user mapped to a user id especially for the root user.

> aodb01:~ # exit
> logout
> 
> It would be nice, if you tell us if this is a mistake or if we have a
wrong
> understanding.

Hopefully that explanation helps with your understanding.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]