Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2014
    Location
    Cullman, AL
    Posts
    4

    who and w does not display x server session user


    I have Slackware 14.1 on a MSI Wind U100. I've been using Ubuntu for 10+ years. I have a script attempting to run xrandr. This is not working correctly (I can go into this, but I think my issue is below). Google is not my friend in this because everything says it should work as expected. In my investigations, I found what I think is the root issue, that being something that I just haven't configured quite correctly.

    Installation of Slackware was: Full Installation excluding KDE and XFCE. XDM is DM, fluxbox is WM. runlevel is 4.

    Logged into fluxbox (user), tty1 (root) and tty2 (user)
    On tty1 or tty2, who and w only shows the tty sessions.
    Code:
    USER     TTY     FROM       LOGIN    IDLE    JCPU   PCPU  WHAT
    root     tty1      -         13:05    19:05   0.15s  0.14s -bash
    user     tty2      -         13:05    19:05   0.15s  0.14s -bash
    I open a terminal in flux box, then who and w (in either tty) show both tty sessions, and the lone terminal session
    Code:
    USER     TTY     FROM       LOGIN    IDLE    JCPU   PCPU  WHAT
    root     tty1      -         13:05    19:00   0.15s  0.14s -bash
    user     tty2      -         13:05    19:05   0.15s  0.14s -bash
    user     pts/0   :0.0        13:35    6.00s   0.04S  0.00S -bash
    On my workstation, which is Ubuntu 14.10, logged into xfce, and logged into a tty, running who and w in the tty shows that xfce session.
    Code:
    USER     TTY     FROM       LOGIN    IDLE    JCPU   PCPU  WHAT
    root     tty1      -         13:05    19:00   0.15s  0.14s -bash
    user     tty2      -         13:05    19:05   0.15s  0.14s -bash
    user     :0      :0          11:45    ?xdm?   0.10s  0.15s upstart --user
    user     pts/0   :0.0        13:35    6.00s   0.04S  0.00S -bash
    I know slackware doesn't have upstart, so I won't see that. But, it seems that I'm missing an important piece. I'm not using a DE, but simply a WM, and I feel Google is out right mocking me. Maybe I'm just not competent enough to see that they've given me correct information, but xdmcp doesn't seem appropriate, nor does it seem appropriate to forward X over ssh and I really don't see how hardware acceleration in Xorg will help me.

    What am I missing? What configuration settings do I need to make sure I have?

  2. #2
    Just Joined!
    Join Date
    Dec 2014
    Location
    Cullman, AL
    Posts
    4
    So, from another site, I've received a bit of help.

    I was asked if last recorded the login, and if I received a message "Registering your session with wtmp and utmp."

    Last does not register the user login from fluxbox, but it does log all tty logins. I also could not find any indication in any log files any indication that my session was logged with wtmp and utmp, although if that's recorded in some location other than /var/log, .xsession-errors or the fluxbox log file ($HOME/.fluxbox/log) then I'll need to know where to look.

    The posters suggestion led me to see where wtmp and utmp would be set from and saw that sessreg is what I needed to find. I found it in my /etc/X11/xdm/Xstartup file. It does call it, but apparently isn't operating as I expect it. Unfortunately, this is where I'm stuck at as I'm not sure where to go from here.

  3. #3
    Just Joined!
    Join Date
    Dec 2014
    Location
    Cullman, AL
    Posts
    4
    [due to the fact that I haven't made 15 posts, I'll describe how to view the posts I found]

    Okay -- seems there's a apparently issues with XDM not registering correctly going back to at least 2003.

    Here's a posting from (archlinux topic id 131024) ArchLinux that suggests to either make an edit with in pam (not a solution as I don't have pam installed) or use gdm, lxdm or kdm (which, I'm assuming is either going to set pam correctly).

    However, I'll attempt to use this posting from bodenstab.org (xdm.html). It's from 2003, but I'll make back up of the files and see if it takes care of the issue.

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Dec 2014
    Location
    Cullman, AL
    Posts
    4
    With assistance from jpollard at linuxquestions.org, I was able to resolve this.

    If you look at /etc/X11/xdm/xdm-config you see the following:

    Code:
    ...
    ! All displays should use authorization, but we cannot be sure
    ! X terminals may not be configured that way, so they will require
    ! individual resource settings.
    DisplayManager*authorize:	true
    !
    DisplayManager*chooser:		/usr/lib64/X11/xdm/chooser
    DisplayManager*startup:		/usr/lib64/X11/xdm/Xstartup
    DisplayManager*session:		/usr/lib64/X11/xdm/Xsession
    DisplayManager*reset:		/usr/lib64/X11/xdm/Xreset
    DisplayManager*authComplain:	true
    ! The following three resources set up display :0 as the console.
    DisplayManager._0.setup:	/usr/lib64/X11/xdm/Xsetup_0
    DisplayManager._0.startup:	/usr/lib64/X11/xdm/GiveConsole
    DisplayManager._0.reset:	/usr/lib64/X11/xdm/TakeConsole
    
    DisplayManager*loginmoveInterval:	10
    ...
    Note the definitions for the "startup", resources.

    First is set "DisplayManager*startup: /usr/lib64/X11/xdm/Xstartup".

    The contents of this Xstartup file is:

    Code:
    #!/bin/sh
    # Register a login (derived from GiveConsole as follows:)
    #
    exec /usr/bin/sessreg  -a -w /var/log/wtmp -u /var/run/utmp 	-x /usr/lib64/X11/xdm/Xservers -l $DISPLAY -h "" $USER
    Which will register the user in the wtmp and utmp file.

    Now observe the following entries under the "! The following three resources set up display :0 as the console.".

    The "DisplayManager._0.startup: /usr/lib64/X11/xdm/GiveConsole". This overrides the Xstartup entry provided by default...

    The contents of GiveConsole are:
    Code:
    #!/bin/sh
    # Assign ownership of the console to the invoking user
    #
    # By convention, both xconsole and xterm -C check that the
    # console is owned by the invoking user and is readable before attaching
    # the console output.  This way a random user can invoke xterm -C without
    # causing serious grief.
    #
    chown $USER /dev/console
    This does NOT register the login in the umtp or wtmp files.

    It isn't supposed to.

    If you DO want the user registered, then you have ADD the line

    Code:
    exec /usr/bin/sessreg  -a -w /var/log/wtmp -u /var/run/utmp 	-x /usr/lib64/X11/xdm/Xservers -l $DISPLAY -h "" $USER
    This must be the LAST line (you can remove the "exec" if you want other commands to follow it though).

    The choice of not registering the user as root is deliberate. I have seen places (usually on servers mind) where the console user is not registered to allow that user to check up on other users of the system without alerting them to the presence of the system administrator. (I caught a rogue user using zsh notify options to report when an user logged in - and logged out if it was one of the staff).

    It also tends not to apply if the user is on a single user workstation as that is normally a don't care situation.

    If you do want the user registered, then just add the sessreg command line to the GiveConsole file.
    Added the sessreg -a and sessreg -d to the GiveConsole and TakeConsole scripts respectively and now who and w both show my xsession user.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •