So my workstation at work got rebooted and I'm currently not logged in physically there with a graphical session. I have ssh access to it, and I can start a new X windows session and use my graphical applications remotely. I was just wondering if there was a way to start the main desktop session remotely, so that I can then connect and interact with it and next time I get in front of the workstation, I can just pick up where I left off...
You can start a console GUI session remotely: run
startx. However, that's likely not to work because you'll lack the permission. On most setups, only the user physically logged in on the console is allowed to use the console.
Different distributions have adopted different mechanisms to control who can start an X session on the console. I believe that on RHEL this is done through systemd, but I don't know how.
If you start an X application on the console display, you won't be able to interact with it remotely. There are a few exceptions such as Emacs that are capable of connecting to multiple displays, but in general X applications open a connection to the X display when they start and never look back. You can use Xmove or Xpra to mediate between the X server and the application; an X application started inside Xmove or Xpra can be moved to a different X server (like detaching and attaching a screen session).
Another option once you've started the console X session would be to interact with it remotely. You can use X11vnc for that, and access the remote session with a VNC client.
I'd suggest a look at the following projects (although I kind of doubt that
xpra can handle a whole session)
Xpra is 'screen for X': it allows you to run X programs, usually on a remote host, direct their display to your local machine, and then to disconnect from these programs and reconnect from the same or another machine, without losing any state. It gives you remote access to individual applications.
(Something more direct might be possible (see this note of "startx over ssh"), but it the "picking up where I left part" will not work.)
Edit Something just crossed my mind -- if you use some desktop manager that supports auto-login (say, slim, nodm, gdm3, kdm); you should be able to start a session for one specific user on
:0 (via, say,