I KNOW there are other very similar questions here already - but this is subtly different - I have been through all of the similar ones, and none of the advice there solves the issue I am seeing.
It is the logged-in or -out status of the server local user, which differs here (see below) and I don't see why that impacts on what I'm doing.
I have this situation:
Server PC running Lubuntu 16.04
Client PC running Lubuntu 18.04
Want to remote-access Server PC from Client PC, using vino-server for VNC, tunneled through SSH.
a. I have vino-server installed on the Server and Remmina on the client: these work fine together.
b. I'm familiar with SSH tunnels constructed with the ssh -g - L formulation - that works fine too;
c. If I leave vino-server running and the Server has a keyboard logged in locally, ALL WORKS FINE.
d. But for additional security, I'd like NOT to leave vino-server running all the time, but remote-in initially with a simple remote SSH session, to start it, when I need it. So to test this, I closed vino-server, and logged off as a local user of the Server, and tested remotely. In THIS situation, I can't get the vino-server to start.
a. If vino-server is NOT running, but there IS a locally logged on user at the Server PC, if I ssh in to start vino, I get the "could not connect to display" problem;
-- that is solved, by the advice from this question:
How to start a GUI software on a remote Linux PC via SSH
-- essentially, enter export DISPLAY=:0 and then proceed, and all is then good;
b. BUT... if the locally-logged-in user (keyboard) at the server, is logged out, then, the above fix does NOT work. I cannot start vino-server whatever I do.
I've tried various other recommended advice, including more complex forms of the
..command, also xhost + , but none of these work.
This seems like it is something simple, because the difference between working and non-working is only that the local user (irrelevant to the process ?) at the server, is logged OUT in the problematic case and logged IN in the working case.
Incidentally: some advice recommended using screen to segregate the session which runs vino-server; I have tried that too: doesn't solve it.
Any and all wisdom on this subject would be appreciated.
PS: Not sure if Lubuntu 18.04 has moved to Wayland, and if that's relevant.. I think it may have.