D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Commandeering X


On 23/01/14 09:41, Philip Hudson wrote:
> On 22 January 2014 17:39, bad apple <mr.meowski@xxxxxxxx> wrote:
>> One of us is very confused, and it may well be me.
> It does seem to be inherently confusing, probably because it is such a
> near-useless corner-case that nobody ever needs it.
> What I want:
> Dismiss the mdm greeter which is on the X display and start my desktop
> session on that same X display, without touching the mouse or keyboard
> attached to the X display, using the command line *only* in some kind of
> background/parallel/ssh character-mode *ty login.
> Crucially, no other host is necessarily involved in achieving this; a
> character-mode dumb terminal would suffice for getting me the command line
> I need. In practice, another host will be used, but *only* for logging in
> and displaying my terminal session via ssh.
> The end result is a desktop session running on the X display ready for
> normal keyboard/mouse input exactly as if I had logged in using the mdm
> greeter -- but I didn't! Yippee!
> That's as simply as I can put it.
> "Without touching the mouse or keyboard attached to the X display"
> necessarily precludes using a Ctrl-Alt-F1/F2/etc pseudo-terminal, which
> would otherwise be a good call, and was certainly worth mentioning.
> The obvious workaround is to use the mouse and keyboard attached to the X
> display as God intended. This is acceptable, but I want to know, if only
> for completeness' sake, how I would achieve the goal set out above.

Ok, I *think* I get it now... I think what you're aiming to do is as

You have a PC (we'll call it "Mint") running LDME, sat at a graphical
login prompt on MDM. You also have another machine which for this
example we'll say is a laptop, running Debian (we'll call this one
"Debian"). What you want to do is SSH from Debian into Mint, dismiss the
MDM greeter completely and then initialize a fully logged in graphical
session for your user account on Mint, from Debian, whilst never
touching the keyboard or mouse on Mint. Is that right?

Presuming that this is what you want to do, here is how.

1: SSH into Mint, obviously, from the Debian laptop or whatever
2: Kill the existing GUI login: sudo service mdm stop
3: vi .xinitrc (enter the appropriate info*)
4: startx

And that's it. The info* depends on whatever you use for your normal
login session, but it's likely to be one of:

# exec gnome-session
# exec startkde
# exec startxfce4
# exec wmaker
# exec icewm
# exec blackbox
# exec fluxbox
# exec openbox-session

If you don't want to touch the existing X session at all, instead of
using "startx" you could be more technical and spin up a new instance of
X entirely with something like:

xinit -- :1 -nolisten tcp vt$XDG_VTNR

Which will start up a secondary instance of X on :1 whilst preserving
current session information. The remote machine Mint will immediately
switch to this new session although you will need to configure it
further to avoid just being dumped at a raw X screen with an xterm.

In my brief testing on a handy VM, I unsurprisingly got hit with:

X: user not authorized to run the X server, aborting.

You can either do "sudo startx" (which you really, *really* shouldn't
do) or make a potentially insecure modification to your system:

dpkg-reconfigure x11-common

Here choose "anybody", and then rerun your startx command: this time the
.Xauthority* stuff won't get in your way and it will initialize as
expected. At this point you could now get up from behind your Debian
laptop, walk over to the Mint PC and sit down in front of your own
session, fully logged in and ready to accept keyboard/mouse input.

So, I really hope this answers your question! If I have got it correct,
then I'll have to agree with you: I don't know why anyone would actually
want to do this but you make a very fair point that that doesn't matter,
sometimes you just have to know how to do something even if it's not
ever going to be used.

I should also point out that there are still some weird buggy issues
here: I briefly tested this on Mint 16 and Ubuntu 13.10 VMs and had
complete success using the awesome DM, my favourite and default
lightweight DM choice. Both the Mint and Ubuntu machines had less
success kicking off KDE4 or Gnome3 sessions via startx, sometimes
failing to load certain components like compiz or even OpenGL properly,
resulting in usable but slightly borked sessions. Sometimes they both
loaded completely normally though and I don't feel like bothering to
figure out why is worth it.


The Mailing List for the Devon & Cornwall LUG
FAQ: http://www.dcglug.org.uk/listfaq