8

I have two machines, both running kubuntu: server & client. I'd like to connect to server from client and start the full graphical interface without fear that some commands would be run as client user.

So, ssh -XC works and I can also start graphical programs from it just fine.

However, when I type startkde in the ssh console, it says "KDE seems to be already running on this display." Which is true, but not for the same user account.

I tried exiting graphical interface and logging in from tty, but that then (unsurprisingly) failed to start any graphical programs, including kde.

How then can I do this such that I could simply log in just as I log in with a local user? Use client machine as a dumb terminal.

9

XDMCP is designed for this. On your server, you need to enable XDMCP support in your desktop manager:

  • if you're using kdm, look for

    [Xdmcp]
    Enable=false
    

    at the end of your kdmrc, change false to true and restart kdm;

  • if you're using lightdm, add

    [XDMCPServer]
    enabled=true
    port=177
    

    to /etc/lightdm/lightdm.conf and restart lightdm.

Then on your client, start X using

X -query ${SERVER_IP}

(with the appropriate IP address instead), and your server's login screen should show up on your client.

  • thanks, exactly what I needed. Funny uncle G didn't find it and I had to ask. – velis Dec 2 '16 at 9:18
  • 2
    This works, but XDMCP means you're using the plain X11 protocol, which does not support encryption. If that's a problem, you need to look for other solutions – Wouter Verhelst Dec 2 '16 at 11:34
3

You can turn on the VNC server

Settings>Sharing>Screen Sharing

Then proxy forward 5900 over ssh to your pc if you need to use ssh.

ssh -L 5900:localhost:5900 #destination here

then use a RD client like Remina to connect to the local ssh proxy so;

Connect>127.0.0.1:5900

Be sure to look into the security failures of VNC before you use it. VNC should be pretty safe to use if your tunneling it over ssh. This method will only work if you have an user logged in. In order to get it to work without a user logged in, you will need to ssh in, start a VNC server and specify what display to use I.E. 0, 1, 2 and then connect to it using Remina or something from wherever.

  • I have installed x11vnc on ubuntu. So if no user has logged into system then command to start x11vnc is x11vnc displaynumber:1 is that correct ? – AnkurTank 2 days ago
2

You can start a window manager over an SSH session, but you need to ensure that your X server isn't running a window manager already then.

This can be accomplished in two ways:

  1. Do everything manually, rather than using startx or a display manager:

    First, start your X server:

    X -nolisten tcp :0
    

    now change to another virtual console (e.g., hit ctrl+alt+f2), and type:

    DISPLAY=:0 ssh -XC <host> startkde
    

    Now switch back to the first virtual console and use your X session normally. The downside of this method is that it doesn't include xauth setup (so that in theory everyone on the remote machine will be able to connect to your X session, which is a security risk); you may wish to add that.

  2. Use the .xinitrc (for startx) or .xsession (for display managers) files to modify your window manager:

    If you have set up your system so passwordless SSH works, (e.g., through ssh keys, or by using Kerberos or some other authentication mechanism), you can add the following line as the final line in your .xinitrc or .xsession files:

    exec ssh -XC <host> startkde
    

    The thing to remember is that whatever you add to those files will be executed instead of your normal X11 session setup. In some cases, you may need to select the "standard Xsession" option on your logon screen.

    Even if you don't have passwordless SSH, this may still work, provided you have ssh-askpass installed. If ssh determines that it doesn't have a controlling terminal but it does have a $DISPLAY variable set, it will use that to ask for a password.

    Downside of this method is that it becomes harder to log in to the "local" machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.