Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Remotely Desktop attempts via xdmcp or vnc

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
gfurst
Posts: 184
Joined: 2010-04-10 23:14

Remotely Desktop attempts via xdmcp or vnc

#1 Post by gfurst »

Hello fellow debianauts.
Let me explain what I've been through and what I'm trying to accomplish.

I'm trying to get an laptop running more or less like a headless server, my reasons are not all that serious.
Mostly I want to leave the laptop running as a seed box when my main PC is turned off, also want to setup it up as a media top, common place for media files and playback on Tv.
So essentially I want to be able to access the remote machine, preferably sharing the same session and persisting while I log out from remote.

What I've done:
  • setup keys for ssh to connect automatically between machines, so I can login via terminal, access the file system without issues, which is already a great step.
  • enabled remote access on remote machine lightdm manager
  • setup deluge for daemon torrenting, which enables almost seamlessly client to connect remotely (though deluge is not the best with speed)
What I've tried so far:
  • Connect directly with a new X session

    Code: Select all

    X -query your_server_ip :1
    Works alright, creates a new display (:1) which is oddly in F2 tty instead F8 as is expected. Works alright, not much lag, audio is not routed.
    But an issue! whenever I decide to log out X will simply shutdown, screen goes black and I can't resume on my regular session on my local machine.
  • Connect X with nested Xephyr session

    Code: Select all

    Xephyr -query your_server_ip -screen 1280x1024 :1
    This works too and might be the best solution yet, a windows is created and the remote session is nested in your current X session.
    Visual and performance is ok. Only real issue is that session is not shared, eg, application will not remain running...
  • Connect via VNC
    So it seems only solution for shared sessions is VNC.
    With the remote desktop apps from KDE (which is the DE for both), I can connect buzz around and etc, but its kinda cumbersome and laggy, password always resets and I usually need to accept on the remote machine.
    I've tried setting up lightdm to allow a vncserver at logon, but this is erratic at best, took a long time to get the Xvnc command correct enough for me to login remotely, and even then got a garbled screen and the X session wasn't even the same...
    Image
So that's it...
Isn't there a way of regular X session sharing in the remote computer?
Or a better solution for lightdm vnc invoke?
Please share your experience with remote application and desktop sharing for personal use.

gfurst
Posts: 184
Joined: 2010-04-10 23:14

Re: Remotely Desktop attempts via xdmcp or vnc

#2 Post by gfurst »

Replying to my attempts above, in case anyone else finds it useful.

So as far as I can tell there's no way to share already existing session with X.
When trying to start X directly in another display, it goes to F2 instead of F8, I suspect this is due to a KDM "feature", KDM allows user switching which is basically another X session, so it might reserve F7~F9 or something.

Still I'm able to get nested session easily enough with: (remember to change remote ip and WxH to appropriate values)

Code: Select all

Xephyr -query 'remote_ip' -screen WxH -br -terminate -reset :1
To tap into the already existing X session, seems there is no other way than a vnc server. So to enable a vnc server from start-up login screen through all the session, I've made it a service.
Chose x11vnc for this task, as it seemed appropriate. As mentioned above I tried with built-in lightdm config, but that doesn't quite work and uses a different display too.
So I've created this file:

Code: Select all

/lib/systemd/system/x11vnc.service 
[Unit]
Description=X11vnc server at runtime
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -display :0 -rfbport 5900 -forever -auth /var/run/lightdm/root/:0 -allow 192.168.0.6 -xrandr -xkb -repeat -noxdamage -o /var/log/x11vnc.log

[Install]
WantedBy=multi-user.target
First notes:
It seems that "/lib/systemd/system/" is the new proper place for services. I've used "-allow" to grant access only to this ip, the option "-rfbauth" allows to use a password file, you can create with vncpasswd or "x11vnc -storepasswd", read on it.

After you've done the properly service file in the proper place, use systemctl to enable stuff:

Code: Select all

systemctl daemon-reload
This will make the systemd aware of the service.

Code: Select all

systemctl start x11vnc
This will start the service at the moment, so you can test the configuration, but will not enable the service to start regularly.

Code: Select all

systemctl enable x11vnc
Once you're certain of your configuration, enable the service, test, and enjoy!

Some useful references:
What seems to be x11vnc farther: http://www.karlrunge.com/x11vnc/
Arch wiki help page: https://wiki.archlinux.org/index.php/X11vnc
Ubuntu help page: https://help.ubuntu.com/community/VNC/Servers#x11vnc
Debian service daemon page: https://wiki.debian.org/Daemon
Some random blog: https://prismsoul.wordpress.com/2014/06 ... ntu-14-04/

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Remotely Desktop attempts via xdmcp or vnc

#3 Post by Head_on_a_Stick »

gfurst wrote:It seems that "/lib/systemd/system/" is the new proper place for services.
Not at all critical but custom unit files should be placed in /etc/systemd/system

/lib/systemd/system is generally used by installed packages; unit files in /etc/systemd/system will over-ride any settings in the former location.

See systemd.unit()
deadbang

gfurst
Posts: 184
Joined: 2010-04-10 23:14

Re: Remotely Desktop attempts via xdmcp or vnc

#4 Post by gfurst »

Head_on_a_Stick wrote:
gfurst wrote:It seems that "/lib/systemd/system/" is the new proper place for services.
Not at all critical but custom unit files should be placed in /etc/systemd/system

/lib/systemd/system is generally used by installed packages; unit files in /etc/systemd/system will over-ride any settings in the former location.

See systemd.unit()
Ahh ok, I was wandering about that. I was just that I saw reference to being /etc/systemd/system but couldn't file certain stuff there.
I think it was the transmission-daemon stuff, makes sense now.

Post Reply