Recently we received a request from client to install TigerVNC on our Redhat server to access it remotely. There is a firewall rule already open to access the server using SSH and we don’t want to open any more ports as this is a temporary request.
Using the guide provided by Redhat we have installed and confiugred TigerVNC on display_number 1 https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-TigerVNC.html ( VNC server runs on port 5901 if the display is 1, 5902 if the display is 2 and so on..).
Now we need to connect to server on port 5901 over port 22.
Step 1: On server open /etc/ssh/sshd_config , set “X11 Forwarding” to yes and then reload ssh.
Step 2: On client side open putty ->Give Server IP and leave port as 22 -> Go to Connections -> SSH-> X11 -> Enable Forwarding -> Right below there is Tunnels-> Give source port as 5901 and Destination as “127.0.0.1:5901” then add it. Connect to server -> provide username and password.
Step 3: Open VNC Viewer and connect to 127.0.0.1:5901 using password which will be forwarded to the server.
I loved this article on the same topic and all credetis to the author: http://cects.com/ssh-local-and-remote-port-forwarding-with-vnc/