1829571 Members
3393 Online
109992 Solutions
New Discussion

whoami

 
Ramesh_20
Occasional Contributor

whoami

Hi,
I am having a weird problem in linux boxes. They are behaving indifferently to the whoami command. When i type whoami its showing a different username and also the terminal pts/2 for 5 or 6 users. I understand that each user needs to be assigned a different terminal like pts/1 pts/2 etc...but how come one tty pts/2 is used for too many users. Is that affecting the whoami to display the correct user? Any help appreciated
5 REPLIES 5
Jerome Henry
Honored Contributor

Re: whoami

It could be normal if all of them are connected remote to your linux box. Is it the case ?

J
You can lean only on what resists you...
Ramesh_20
Occasional Contributor

Re: whoami

But i am logged in as user-1 and but it is showing as user-2!!!We are having problems while executing some scripts for monitoring and totally that screws up entire stuff
Jerome Henry
Honored Contributor

Re: whoami

Check user-1 and user-2 uid in /etc/passwd or /etc/shadow, and check with 'who', 'w' and 'users' who the system sees as logged in.

There seems to be a mess with your authentication. Are you logged local or remote ?

J
You can lean only on what resists you...
Stuart Browne
Honored Contributor

Re: whoami

Sounds like your /var/run/utmp is up the creek.

'who', 'w', 'whoami', 'last', and all of those sorts of tools use /var/run/utmp to keep track user logins.
One long-haired git at your service...
Stuart Browne
Honored Contributor

Re: whoami

Oh sugar. Forgot to say how to fix it :P

Get everybody off the machine, zero out the file (move it aside is probably best), sign in and check again.
One long-haired git at your service...