VNC over SSH
eNOTE: The X2Go Client is an easier alternative to VNC over SSH
This example is one method of setting up a secure VNC session tunneling over SSH. It assumes a VNC server has been installed on the remote system.
First SSH into the remote system configure the VNC session and start VNC server
- Run the command vncpasswd to create a VNC session password. It is separate than your login password, but can be set the same
- The vncpasswd command can also change/reset an existing password
- The vncpasswd command will create a ~/.vnc directory if it does not exist
- If needed, edit the file ~/.vnc/xstartup
Start vncserver
macOS
After the vncserver is running, on the Mac open the Teminal app in the Applications → Utilities folder
Create a SSH tunnel to remote VNC session using the command:
ssh -L 8888:127.0.0.1:5902 <username>@<servername>.ae.utexas.edu
- 8888 is the local port number
- 5902 is the remote VNC session port created above
Select "Connect to Server..." under the Go menu in the Finder. Enter the server name:
Enter your VNC session password
Windows
Download and unzip MobaXterm Home Edition (portable edition)
Open MobaXterm and start local terminal
After the vncserver is running, in MobaXterm select the Session icon to configure the VNC session
Select VNC and enter name or IP address of the VNC server in the remote hostname and select the port the vncserver was started on like 5902 in the example above
Select the Network settings tab in the image above, then select the SSH gateway (jump host)
In the Gateway host info, enter the VNC server name and your logon name.
Select the Bookmark settings and change the session name from localhost to the remote system name
When you connect (execute) the session, it will first ask for your remote system password, then ask for your vncpasswd