LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-10-2014, 03:23 PM   #1
Anaximander
LQ Newbie
 
Registered: Sep 2004
Location: Alabama
Posts: 22

Rep: Reputation: 0
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?
 
Old 12-11-2014, 08:52 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,123

Rep: Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260
Do you get this message when fluxbox starts?
Code:
 Registering your session with wtmp and utmp
Does the "last" command show the login?
 
Old 12-11-2014, 10:46 AM   #3
Anaximander
LQ Newbie
 
Registered: Sep 2004
Location: Alabama
Posts: 22

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by smallpond View Post
Do you get this message when fluxbox starts?
Code:
 Registering your session with wtmp and utmp
Does the "last" command show the login?
I grepped all files in /var/log ( find . -type f -exec grep -H [wtmp|utmp] {} \; ) None of the files had "Registering your session ... wtmp and utmp". I flux starting with logging, I do not see any message for wtmp or utmp in that log file, and I see no errors for wtmp or utmp in .xsession-errors. I'm not familiar with wtmp or utmp, I do see the files in /var/log, but they appear to be in binary form.

However, last does show each of the logins for today (3 logins, root on tty1, user on tty2, user on flux): one for root on tty1, one for user on tty2 and one for user on pts/0. However, user on pts/0 appears to the open terminal I have in the fluxbox session. I rebooted and checked again (this time with out opening a terminal in flux). The results on that are (2 logins, user on tty2, user on flux): one for user on tty2.
 
Old 12-11-2014, 03:07 PM   #4
Anaximander
LQ Newbie
 
Registered: Sep 2004
Location: Alabama
Posts: 22

Original Poster
Rep: Reputation: 0
So, noticing something interesting.

I started searching for where sessreg would be called, I should have googled this one sooner. My /etx/X11/xdm/Xstartup calls sessreg.
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/lib/X11/xdm/Xservers -l $DISPLAY -h "" $USER
So, it seems something is borked somewhere, although I'm not sure where to start looking for that.
 
Old 12-11-2014, 07:06 PM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
What display manager are you using to login?

If you are using startx, then it will not show any additional login.

The display manager provides a GUI to login. The GUI is what records the session identification in the utmp/wtmp files. It has to be set by root.

xdm provides a GUI login that does this. So does kdm.
 
Old 12-12-2014, 07:44 AM   #6
Anaximander
LQ Newbie
 
Registered: Sep 2004
Location: Alabama
Posts: 22

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jpollard View Post
xdm provides a GUI login that does this.
XDM is the DM. fluxbox is the WM. Runlevel 4.
 
Old 12-12-2014, 09:32 AM   #7
Anaximander
LQ Newbie
 
Registered: Sep 2004
Location: Alabama
Posts: 22

Original Poster
Rep: Reputation: 0
Okay -- seems there's a apparently issues with XDM not registering correctly going back to at least 2003.

Here's a posting from 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. It's from 2003, but I'll make back up of the files and see if it takes care of the issue.
 
Old 12-12-2014, 06:45 PM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
No - there is nothing wrong with XDM.


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.

Last edited by jpollard; 12-12-2014 at 06:47 PM.
 
Old 12-12-2014, 07:20 PM   #9
Anaximander
LQ Newbie
 
Registered: Sep 2004
Location: Alabama
Posts: 22

Original Poster
Rep: Reputation: 0
jpollard, thank you for that.

I was about to start trying to figure out what changes I needed to make. That's interesting, I appreciate learning something new. Now that you point out the setup, startup and reset overrides, it seems obvious to me and that I should have picked up on it, but again, I was on Ubuntu, and I didn't have to bother with this. My goal is to learn linux better, I'm on my way.

Following the logic, I'll add the sessreg command to the end of the GiveConsole script, then I should also add the sessreg command that unregisters (sessreg -d ...) to the end of the TakeConsole script as well. That way when I log out of the xsession, then I should no longer show up in a w or who listing. Or do I have a flaw in my reasoning?
 
Old 12-12-2014, 09:58 PM   #10
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Yes - I actually forgot about the unregistration.
 
Old 12-15-2014, 10:20 AM   #11
Anaximander
LQ Newbie
 
Registered: Sep 2004
Location: Alabama
Posts: 22

Original Poster
Rep: Reputation: 0
Well, after having tested it out, I was able to resolve the original issue that took me down the path of registering the user. I had some other issues with the script, but I was able to export the display correctly after registering the user.

Thank you for the help. jpollard, I had this issue opened in another forum that I've been updating through this, I'll credit your response and post excerpts from so other users can see it at either site.

Last edited by Anaximander; 12-15-2014 at 10:21 AM.
 
Old 12-15-2014, 11:31 PM   #12
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Thanks.

You might mark the issue "solved"...
 
Old 12-16-2014, 08:06 AM   #13
Anaximander
LQ Newbie
 
Registered: Sep 2004
Location: Alabama
Posts: 22

Original Poster
Rep: Reputation: 0
Thank you for the reminder. Done.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create an single User session in Proxy Server vijaybhandari Linux - Newbie 1 05-23-2014 01:10 PM
How to isable multiple session for a single user on RedHat server Graphical interface nripendra.patwa Linux - Newbie 1 05-15-2014 10:31 AM
Not able to open display of remote server if client is user and server is root unclesamcrazy Linux - Newbie 16 07-22-2013 01:08 PM
How to disable multiple session/logins per user PPTP-server Zurvy Linux - Networking 1 10-18-2008 07:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration