# yum groupinstall "GNOME Desktop" # yum install tigervnc-server
# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:<PORT>.service
<PORT> schould be set to the portnumber you want to use. Eg: 32 for port 5902
[Unit] Description=Remote desktop service (VNC) After=syslog.target network.target [Service] Type=forking ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' ExecStart=/usr/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i -geometry 1280x1024 -nolisten tcp -localhost" PIDFile=<USER DIR>/.vnc/%H%i.pid ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' [Install] WantedBy=multi-user.target
-geometry 1280x1024
-> assigns the resolution for the vnc-client.
-nolisten tcp
-> disables login via tcp.
-localhost
-> allows only login via localhost.
Replace <USER> and <USER DIR> with the user/user dir you want to login with
# firewall-cmd --permanent --zone=public --add-port=5902/tcp # firewall-cmd --reload
Assign the port to your chosen one.
# vncserver
The chosen password doesn't have to (and should not) be the regular login password.
# systemctl daemon-reload # systemctl start vncserver@:2.service # systemctl enable vncserver@:2.service
Again change the port accordingly.
# ssh -N -L 5902:localhost:5902 <USER>@<server>
This opens a tunnel to the vnc-server.
The port localhost:5902
on the client will tunnel to the port localhost:5902
on the server.
Substitute port, user and server accordingly.
Set the hostname, port and protocol under "Session" to SERVER ADRESS
, 22
(for ssh) and ssh
.
Under "Connection -> SSH -> Tunnels set the source port to 5902
(this is the port on the client) and as destination localhost:5902
(this is the port on the server).
There are several viable VNC-Viewer. Choose one to your liking and connect to localhost:5902