First, install the vnc packages.
su dnf -y install tigervnc tigervnc-server firewall-cmd --add-service=vnc-server --permanent firewall-cmd --reloadI am getting a lot of information from this pages, but it is out of date. Fedora has changed everything. The first link explains this (sort of), but I did not discover it until very late in the game. Next I setup a user:
su useradd -m pilot passwd pilot su - pilot vncpasswdI login as "pilot" and type "vncserver" -- lo and behold the command does not exist! Apparently you no longer launch it via vncserver, but use some systemd magic to do this, which may be what I want anyway. The vncserver command is hidden away in /usr/libexec/vncserver but you probably don't want to actually run that. So, I do this as instructed:
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@.serviceEven the instructions in the Fedora document are out of date, the header of the above service file gives some tips:
1. Add a user mapping to /etc/tigervnc/vncserver.users. 2. Adjust the global or user configuration. See the vncsession(8) manpage for details. (OPTIONAL) 3. Run `systemctl enable vncserver@:I add the line ":1=pilot" to the vncserver.users file, skip (2) for now since they say it is optional, then:.service` 4. Run `systemctl start vncserver@: .service`
systemctl enable vncserver@:1.service systemctl start vncserver@:1.serviceThese seem to work without giving any error messages.
:1=marvin :2=tomThen start the server (which will run on port 5902) as follows:
systemctl enable vncserver@:2.service systemctl start vncserver@:2.serviceAnd it is just that simple.
vncviewer beef:1And it works! I have a session logged in as user pilot (although I am a different user on the originating system). This looks OK, though it would be great if it was properly documented.
The default session gives me a 1024 by 768 desktop. Now how do I make it bigger? One way is to use /home/pilot/.vnc/config, but another is to edit settings in /etc/tigervnc/vncserver-config-defaults. I select the latter, and set:
geometry=1600x1200
Restart=on-failure RestartSec=5sAnd I did this after editing the file:
systemctl daemon-reloadThis has not yet done it, as I see:
systemctl status vncserver@:1.service Active: inactive (dead) since Tue 2020-11-03 17:42:10 MST; 3s agoOK!! The following works, put this in the Service section:
Restart=always RestartSec=5s
Actually this problem went away after starting and stopping VNC the first time, so never mind all of this.
The systemd "unit file" (there, I used the right jargon!) calls /usr/libexec/vncsession-start %i, passing the display number. This is a bash script, which gave me hope, but all it does is to use the /etc/systemd/system/vncserver@.service file to map the display number to the user name, which it then passes to:
exec "/usr/sbin/vncsession" "${USER}" "${DISPLAY}"This is an elf executable, and gets launched running as root.
It is worth noting that /home/pilot/.vnc contains the passwd file as well as "pork:1.log", which is full of stuff, so in some way the vncsession program knows about /home/pilot.
Adventures in Computing / tom@mmto.org