Using VNC to Login
Last updated
Last updated
To run graphical applications remotely, the Virtual Network Computing (VNC) application is available and provides some advantages beyond using X Windows over SSH such as a detachable session and better performance over a slow speed connection. Here is basic set up information required for this approach.
***Important Note: Please follow all of these steps with each new VNC session.***
There are multiple VNC viewer programs available with unique interfaces and features. The application on RCS hosted systems is TigerVNC (). TigerVNC clients are available for Linux and Windows. Mac users can use the built in Apple "Screen Sharing" as a VNC client and do not have to install an additional client.
Login to a remote system via SSH. The host name is $HOST in the steps below.
Set a VNC password (six to eight characters):
$ vncpasswd
Launch the session:
$ vncserver -xstartup /usr/bin/startxfce4 -SecurityTypes VncAuth,TLSVnc -geometry 1600x1280 -localhost yes
Note the X display number for your session:
$ vncserver -list
Log off:
$ exit
If Gnome is the preferred desktop, use /usr/bin/gnome-session instead of /usr/bin/startxfce4 in step A.3.
The remote port to connect to is the "RFB Port #" in the output from step A.4 above. This value is $RPORT in the next step. If "RFB Port #" is not in the output, take the "X Display #" and add 5900 to it.
In a Terminal window, establish an SSH tunnel:
$ ssh -L 59000:localhost:$RPORT -C $HOST
In Finder, launch the remote desktop client by choosing Go->Connect to Server from the menu or press Cmd-K.
Enter vnc://localhost:59000 for the server and click Connect.
Enter the VNC password set in step A.2 above and click Sign In. A window with your personal desktop on the remote host should open.
If needed, install a VNC viewer on your Linux system. A commonly available one is TigerVNC.
The remote port to connect to is the "RFB Port #" in the output from step A.4 above. This value is $RPORT in the next step. If "RFB Port #" is not in the output, take the "X Display #" and add 5900 to it.
In an Xterm window, establish an SSH tunnel:
$ ssh -L 59000:localhost:$RPORT -C $HOST
In a second Xterm window, launch the VNC viewer:
$ vncviewer localhost::59000
Enter the VNC password set in step A.2 above and click Sign In. A window with your personal desktop on the remote host should open.
If needed, download & install a VNC viewer on your Windows system from https://tightvnc.com/download.php.
The remote port to connect to is the "RFB Port #" in the output from step A.4 above. This value is $RPORT in the next step. If "RFB Port #" is not in the output, take the "X Display #" and add 5900 to it.
In a command prompt window, establish an SSH tunnel:
$ ssh -L 59000:localhost:$RPORT -C $HOST
Launch TightVNC Viewer.
Enter localhost::59000 for the remote host and click Connect.
Enter the VNC password set in step A.2 above and click OK. A window with your personal desktop on the remote host should open.
The remote desktop window can be closed at any time. Exit the SSH tunnel session then close the remote desktop window. This does not interrupt the remote desktop session. It will remain until you log out from it or the workstation is rebooted. To reconnect to the remote desktop session, repeat the steps in section B, C, or D. A screen lock may be enabled when you reconnect. Enter your UA password to unlock. To close your VNC session, view the open sessions on the remote system, then close the appropriate one.
Your circumstances might require the use of different ports due to firewall issues or if you are running more than one VNC server session on the remote system. (Other people on the system might be running their own sessions as well and occupying the ports.) If this is the case, you may need to specify port 5902 or 5903 or ... Add 5900 to the display number to determine the correct remote port to use.
To determine whether the VNC viewer has successfully connected, check the log file noted when vncserver was started on the remote system.
After starting the server, the option exists to log out and back in again using different port forwarding parameters.
Note that some VNC viewer programs can automatically set up the SSH port forwarding through a command-line flag such as "-via" or some option in a graphical configuration menu.
Orphaned Session
If a previous VNC session remains open on the remote system, that old session will need to be closed prior to establishing a new connection using the same port. To identify and kill the old session, first obtain the processID of the "Xnvc" process, then issue the kill command.
Locked Session
Depending on your desktop settings on the remote system, the X screensaver may kick in and lock the session after a period of inactivity. If this happens, you'll be prompted for a password that doesn't exist. The xlock process can be killed from the command line. We recommend disabling X locking in the VNC displayed desktop settings to avoid this happening.
Banish Authentication Popup
If you get a "Authentication is required to set the network proxy used for downloading packages" dialog box constantly opening, launch a Terminal Console and type gnome-session-properties and then uncheck the PackageKit Update Applet. You may need to restart your VNC session for this to take effect.
Reset Server Password
To change the VNC server password, use the 'vncpasswd' command on the remote system.
More Information
Run 'vncserver --help' and 'man vncserver' for more information on how to use the application.