My goal was to connect to a remote desktop. Had to tweak systemd to autologin with specific user.
sudo vim /email@example.com/autologin.conf
[Service] ExecStart= ExecStart=-/usr/bin/agetty --autologin mike --noclear %I $TERM
I’m a zsh user so had to add the following into ~/.zprofile
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then exec startx fi
So after these changes after rebooting the PC the X server started and I could connect to it.
Just had to start
x0vncserver -display :0 -rfbauth .vnc/passwd Sat Mar 28 16:18:32 2020 Geometry: Desktop geometry is set to 3840x1200+0+0 XDesktop: Using evdev codemap XDesktop: XDesktop: XTest extension present - version 2.2 XDesktop: RANDR extension not present XDesktop: Will not be able to handle session resize Main: Listening on port 5900
The desktop has no public IP so I had to port forward
ssh vnc-server -L 9900:localhost:5900
Now I was able to connect with vncviewer
vncviewer localhost:9900 TigerVNC Viewer 64-bit v1.10.1 Built on: 2019-12-27 09:17 Copyright (C) 1999-2019 TigerVNC Team and many others (see README.rst) See https://www.tigervnc.org for information on TigerVNC. Sat Mar 28 16:20:09 2020 DecodeManager: Detected 8 CPU core(s) DecodeManager: Creating 4 decoder thread(s) CConn: Connected to host localhost port 9900 CConnection: Server supports RFB protocol version 3.8 CConnection: Using RFB protocol version 3.8 CConnection: Choosing security type VeNCrypt(19) CVeNCrypt: Choosing security type TLSVnc (258)