Bug 244807 - "who" doesn't show the logged in user
"who" doesn't show the logged in user
Status: CLOSED DUPLICATE of bug 222847
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: xterm (Show other bugs)
5.0
i686 Linux
low Severity medium
: ---
: ---
Assigned To: Miroslav Lichvar
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-19 06:46 EDT by uludwig
Modified: 2007-11-30 17:07 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-07-31 06:42:11 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
small programm to read and print utmp (5.45 KB, application/octet-stream)
2007-06-19 06:49 EDT, uludwig
no flags Details

  None (edit)
Description uludwig 2007-06-19 06:46:38 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4

Description of problem:
When I am logged in with gnome and the only terminals open are xterm I do not get the correct information about me being logged in with the command "who" nor "w".

When I open one of the standard terminals"who" (or "w") prints out the correct information.

I assume there is a problem  with utmp. I have a little piece of code that reads the utmp with getutxent(). No USER_PROCESS is in the list if no standard terminal is open. When I open a terminal (not xterm) there is a USER_PROCESS in the list. When I close this terminal this entry changes to DEAD_PROCESS and will not disappear until the next reboot.

Version-Release number of selected component (if applicable):
coreutils-5.97-12.1.el5

How reproducible:
Always


Steps to Reproduce:
1. Login with gnome desktop. No terminal should open automatically.
2. Press Alt-F2 for a command line and enter xterm.
3. Launch who in the xterm. No output will appear.

Possibility 2:
1. Login with kde desktop. No terminal should open automatically.
2. Press Alt-F2 for a command line and enter xterm.
3. Launch who in the xterm. No outpur will appear.
4. Open a konsole and launch who. No output will appear.

Actual Results:
No output from "who". From "w" just the head line:

[uludwig@uranus ~]$ w
 12:44:37 up 19:44,  1 user,  load average: 0.06, 0.05, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT

[uludwig@uranus ~]$ who
[uludwig@uranus ~]$


Expected Results:


Additional info:
We use getutxent() to determine if a user logged in locally. Since Red Hat EL 5 this doesn't work anymore. We need this urgently!!
Comment 1 uludwig 2007-06-19 06:49:07 EDT
Created attachment 157359 [details]
small programm to read and print utmp
Comment 2 Jim Meyering 2007-06-20 01:52:02 EDT
Thanks for the report.  However, it sounds like you're reporting that who DOES
accurately report the contents of the utmp file.  If not, please include the
output who prints along with the corresponding utmp/wtmp file.

Have you read about xterm's -ls option?

Someone reported a similar mismatch between their expectations and who's behavior.
Here's the reply, in case it helps:

http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/10560/focus=10561
Comment 3 uludwig 2007-06-20 09:07:11 EDT
You are right. My report should be a different one. Sorry. 
More like: "No login information is written to utmp"

If I login (gnome or kde or fvwm) this is not logged into utmp correctly. The
corresponding entry appears if I open a gnome-terminal. But if I open a xterm no
entry is made. Even if I launch xterm -ls there is no entry in the utmp file.

I need to determine if a user is logged, who is logged in and if he is logged in
to :0 or remotely. This used to work with previous versions of RH EL.
Comment 4 Tim Waugh 2007-06-25 10:55:25 EDT
It sounds like your problem is about the xterm program.
Comment 5 Miroslav Lichvar 2007-06-25 11:13:39 EDT
It's a problem with xterm and utempter access permissions. The xterm binary
needs setgid utempter to make utmp entries.
Comment 7 Miroslav Lichvar 2007-07-31 06:42:11 EDT

*** This bug has been marked as a duplicate of 222847 ***
Comment 8 Steve Cleveland 2007-08-13 17:03:29 EDT
This bug is marked as a duplicate of 222847, but I don't have permission to view
that bug report, so I'm posting here.

From past experience, logging into gnome should update utmp.  That's where the
problem is.  It shouldn't require opening xterm or gnome-terminal.

Also, of note, if I do 'strings /var/log/wtmp | grep <user>', I see the user
listed.  But 'strings /var/run/utmp | grep <user>', I don't see them listed.
Comment 9 Miroslav Lichvar 2007-08-20 04:19:22 EDT
Steve, please file a bug report against a gnome component, this bug and bug
#222847 is for xterm.
Comment 10 Sigurd Mytting 2007-10-01 09:53:26 EDT
I don't have permission to view 222847, this problem still exits on a fully
updated RHEL5 client; setting group on the xterm-binary and making it sgid does
not work (hey, I've even tried suid to root on the xterm binary without success
- just like it used to be in the olden days:-)

Since this bug has been closed, could someone with access to 222847 either open
it for the rest of us or tell us what's going on?

-Sigurd
Comment 11 Miroslav Lichvar 2007-10-02 08:50:48 EDT
The updated package should be in RHEL 5.1.

You can make the binary setgid utempter with:

chown root:utempter /usr/bin/xterm
chmod 2755 /usr/bin/xterm
Comment 12 Sigurd Mytting 2007-10-03 08:16:55 EDT
Thanks! :-)

Note You need to log in before you can comment on or make changes to this bug.