who / w / logname broken in multiple terminals

Posted on

Problem :

I have a strange problem:
In a GUI session, depending on the terminal being used the following two (related) problems appear:

  1. who and w doesn’t list the user’s active session
  2. logname returns logname: no login name

It happens in the following terminals:

  • lxterminal
  • xfce4-terminal
  • rxvt

On the other hand, in the following scenarios it works perfectly (who/w lists the user and logname functions):

  • ssh-ing in
  • xterm / lxterm / uxterm

Solution :

Check whether lx, xfce, and rxvt are setuid root. If they are not, but xterm is, try setting them setuid root (which rxvt|xargs chmod u+s). Per this:

rxvt tries to write an entry into the utmp(5) file so that
it can be seen via the who(1) command, and can accept mesĀ­sages.  
To allow this  feature,  rxvt  must  be  installed
setuid root on some systems.

“utmp” is /var/tmp/utmp, which lists currently logged-on users. (This describes a related problem in which the values in utmp were not properly updated.)

Leave a Reply

Your email address will not be published. Required fields are marked *