Virtual Network Computing (VNC) is a cross-platform desktop sharing system to interact with a remote system's desktop using a graphical interface. This page covers basic instructions to access a desktop on Cheaha using VNC. These basic instructions support a variety of use-cases where access to graphical applications on the cluster is helpful or required. If you are interested in knowing more options or detailed technical information, then please take a look at man pages of specified commands.
We have been users of RealVNC® for over 3 years. During that time, it has allowed us to remotely connect to 1000 desktops and servers to resolve issues, install software, printers, etc. Saving us many hours of driving time between sites and gives us a quicker response time to resolve issues. First, make sure both your Raspberry Pi and the other computer you’re going to use are. Relicensing VNC Connect at renewal time. For most people, we’ll automatically handle relicensing VNC Server on all your remote computers when your subscription renews. Note, however, if you have: An Enterprise subscription; Originally licensed VNC Server on a particular computer using your 25 character license key. VNC Connect from RealVNC is included with Raspberry Pi OS. It consists of both VNC Server, which allows you to control your Raspberry Pi remotely, and VNC Viewer, which allows you to control desktop computers remotely from your Raspberry Pi should you want to. You must enable VNC Server before you can use it: instructions for this are given below.
|
One Time Setup
VNC use on Cheaha requires a one-time-setup to configure settings to starting the virtual desktop. These instructions will configure the VNC server to use the Gnome desktop environment, the default desktop environment on the cluster. (Alternatively, you can run the vncserver command without this configure and and start a very basic (but harder to use) desktop environment.) To get started log in to cheaha via ssh.
Set VNC Session Password
You must maintain a password for your VNC server sessions using the vncpasswd command. The password is validated each time a connection comes in, so it can be changed on the fly using vncpasswd command anytime later. Remember this password as you will be prompted for it when you access your cluster desktop. By default, the command stores an obfuscated version of the password in the file $HOME/.vnc/passwd.
Configure the Cluster Desktop
The vncserver command relies on a configuration script to start your virtual desktop environment. The GNOME2 desktop provides a familiar desktop experience and can be selected by creating the following vncserver startup script (~/.vnc/xstartup).
By default a VNC server displays graphical environment using a tab-window-manager. If the above xstartup file is absent, then a file with the default tab-window-manager settings will be created by the vncserver command during startup. If you want to switch to the GNOME desktop, simply replace this default file with the settings above.
This completes the one-time setup on the cluster for creating a VNC server password and selecting the preferred desktop environment.
Select a VNC Client
You will also need a VNC client on your personal desktop in order to remotely access your cluster desktop.
Mac OS comes with a native VNC client so you don't need to use any third-party software. Chicken of the VNC is a popular alternative on Mac OS to the native VNC client, especially for older Mac OS, pre-10.7.
Most Linux systems have the VNC software installed so you can simply use the vncviewer command to access a VNC server.
If you use MS Windows then you will need to install a VNC client. Here is a list of VNC client softwares and you can any one of it to access VNC server.
Start your VNC Desktop
Your VNC desktop must be started before you can connect to it. To start the VNC desktop you need to log into cheaha using an standard SSH connection. The VNC server is started by executing the vncserver command after you log in to cheaha. It will run in the background and continue running even after you log out of the SSH session that was used to run the vncserver command.
To start the VNC desktop run the vncserver command. You will see a short message like the following from the vncserver before it goes into the background. You will need this information to connect to your desktop.
The above command output indicates that a VNC server is started on VNC X-display number 24, which translates to system port 5924. The vncserver automatically selects this port from a list of available ports.
The actual system port on which VNC server is listening for connections is obtained by adding a VNC base port (default: port 5900) and a VNC X-display number (24 in above case). Alternatively you can specify a high numbered system port directly (e.g. 5927) using '-rfbport <port-number>' option and the vncserver will try to use it if it's available. See vncserver's man page for details.
Please note that the vncserver will continue to run in the backgound on the head node until it is explicitly stopped. This allows you to reconnect to the same desktop session without having to first start the vncserver, leaving all your desktop applications active. When you no longer need your desktop, simply log out of your desktop using the desktop's log out menu option or by explicitly ending the vncserver command with the 'vncserver -kill ' command.
Alternate Cluster Desktop Sizes
The default size of your cluster desktop is 1024x768 pixels. If you want to start your desktop with an alternate geometry to match your application, personal desktop environment, or other preferences, simply add a '-geometry hieghtxwidth' argument to your vncserver command. For example, if you want a wide screen geometry popular with laptops, you might start the VNC server with:
Stop your VNC Desktop
Stopping the VNC process is done using the vncserver -kill command. The command takes a single argument, the display port.
The VNC server display port can be found using the following command (display port format is a : followed by 1 or more digits):
In the above example, the VNC display port is :4. Terminating the VNC desktop can now be done via:
Establish a Network Connection to your VNC Server
As indicated in the output from the vncserver command, the VNC desktop is listening for connections on a higher numbered port. This port isn't directly accessible from the internet. Hence, we need to use SSH local port forwarding to connect to this server.
This SSH session provides the connection to your VNC desktop and must remain active while you use the desktop. You can disconnect and reconnect to your desktop by establishing this SSH session whenever you need to access your desktop. In other words, your desktop remains active across your connections to it. This supports a mobile work environment.
Port-forwarding from Linux or Mac Systems
Set up SSH port forwarding using the native SSH command.
Above command will forward connections on local port 5924 to a remote system's (same as SSH server host Cheaha - hence localhost) port 5924.
Port-forwarding from Windows Systems
Windows users need to establish the connection using whatever SSH software they commonly use. The following is an example configuration using Putty client on Windows. Be sure to press the 'Add' button to save the configuration with the session and ensure the tunnel is opened when the connection is established.
Access your Cluster Desktop
With the network connection to the VNC server established, you can access your cluster desktop using your preferred VNC client. When you access your cluster desktop you will be prompted for the VNC password you created during the one time setup above.
The VNC client will actually connect to your local machine, eg. 'localhost', because it relies on the SSH port forwarding to connect to the VNC server on the cluster. You do this because you have already created the real connection to Cheaha using the SSH tunnel. The SSH tunnel 'listens' on your local host and forwards all of your VNC traffic across the network to your VNC server on the cluster.
You can access the VNC server using the following connection scenarios based on your personal desktop environment.
From Mac
For Mac OSX 10.8 and higherMac users can use the default VNC client and start it from Finder. Press cmd+k to bring up the 'connect to server' window. Enter the following connection string in Finder:
The connection string pattern is 'vnc://<vnc-server>:<vnc-port>'. Adjust your port setting for the specific value of your cluster desktop given when you run vncserver above.
For Mac OSX 10.7 and lowerDownload and install Chicken of the VNC from sourceforge.Start COTVNC and enter the following in the host window and provide the VNC password you created during set up when prompted:
From Linux
Linux users can use the command
Shortcut for Linux Users
Linux users can optionally skip the explicit SSH tunnel setup described above by using the -via argument to the vncviewer command. The '-via <gateway>' will set up the SSH tunnel implicitly. For the above example, the following command would be used:
This option is preferred since it will also establish VNC settings that are more efficient for slow networks. See the man page for vncviewer for details on other encodings.
From Windows
Windows users should use whatever connection string is applicable to their VNC client.
Remember to use 'localhost' as the host address in your VNC client. You do this because you have already created the real connection to Cheaha using the SSH tunnel. The SSH tunnel 'listens' on your local host and forwards all of your VNC traffic across the network to your VNC server on the cluster.
Using your Desktop
Once we have a VNC session established with Gnome desktop environment, we can use it to launch any graphical application on Cheaha or use it to open GUI (X11) supported SSH session with a remote system in the cluster.
VNC can be particularly useful when we are trying to access and X Windows application from MS Windows, as native X11 setup on Windows is typically more involved than the VNC setup above. For example, it's much easier to start X11 based SSH session with the remote system on the cluster from above Gnome desktop environment than doing all X11 setup on Windows.
Performance Considerations for Slow Networks
If the network you are using to connect to your VNC session is slow (eg. wifi or off campus), you may be able to improve the responsiveness of the VNC session by adjusting simple desktop settings in your VNC desktop. The VNC screen needs to be repainted every time your desktop is modified, eg. opening or moving a window. Any bit of data you don't have to send will improve the drawing speed. Most modern desktops default to a pretty picture. While nice to look at these pictures contain lots data. If you set your desktop background to a solid color (no gradients) the screen refresh will be much quicker (see System->Preferences->Desktop Background). Also, if you change to a basic windowing theme it will also speed screen refreshes (see System->Preferences->Themes->Mist).
There will be times when you can’t - or don’t want to - switch to your Raspberry Pi. Perhaps you’re using another computer, your Raspberry Pi is out of reach, behind your TV or a nest of cables or you’re on the road and have left your Raspberry Pi at home.Fortunately, with VNC (Virtual Network Computing) – free for non-commercial use and built into the Raspbian operating system – you can access Raspberry Pi remotely from any other computer, tablet, or smartphone. Either on your home network, or via the internet.In this walkthrough, we’ll be using VNC Viewer and VNC Server to connect on the fly to a Raspberry Pi from a Windows PC and an Android smartphone.
What you'll need
Raspberry Pi with Raspbian
Network and internet connection
VNC Server and VNC Viewer
Step 1: Enable VNC
First, make sure both your Raspberry Pi and the other computer you’re going to use are connected to the same network.
In Raspbian, click the applications menu icon (raspberry) at the top-left of the screen and select Preferences > Raspberry Pi Configuration.
If you haven’t changed Raspbian’s password from the default ‘raspberry’, now is a good time to do so. Click the Change Password button and enter a new one. Now click the Interfaces tab, and set the radio button next to VNC to Enabled. Click OK. A VNC button appears in the top right of the screen, at the end of the menu bar. Click it to open VNC Server.
Your IP (internet protocol) address will appear in the VNC Server Window (below Connectivity). Note down the four numbers; they enable you to locate your Raspberry Pi over the network.
Step 2: Open VNC Viewer
You’re now ready to connect to your Raspberry Pi from another computer. We’re going to use a Windows PC, but you can connect from a Mac, Linux PC, or even another Raspberry Pi on the same network.
Because we’re using VNC Server on Raspberry Pi, it makes sense to use VNC Viewer on the Windows PC. VNC Viewer is available for macOS, Linux, Android, and iOS platforms, along with a web interface. Head to RealMac (magpi.cc/hTpNBm) and click Download VNC Viewer. Install and open the software.
Step 3: Connect to Raspberry Pi
Enter the IP address of your Raspberry Pi (the four numbers displayed in VNC Server) into the search bar of VNC Viewer (the part saying ‘Enter a VNC Server address or search’). Press RETURN to connect to Raspberry Pi.
The first time you do this, a window will appear with a warning: ‘VNC has no record of connecting to this VNC Server so its identity cannot be checked’. Click Continue.
You need to enter the username (typically ‘pi’) and password for your Raspberry Pi. Click on Remember Password and then OK to connect to Raspbian.
Step 4: Remote control
A window appears on your Windows PC displaying the Raspbian desktop interface from your Raspberry Pi. Move the mouse around the window and you’ll see the mouse moving around on your Raspberry Pi. You can now use this window to control your Raspberry Pi over the network (just as if you were sitting in front of it).
Hover the mouse at the top of the VNC Viewer window and a menu will drop down from the top of the screen. To the left of the Options is Enter Full Screen; click it and the preview window will take over the screen. Your Raspberry Pi display may not fit your PC display, so click the Scale button in the menu (so it’s set to Scale Automatically).
You will now be able to open apps and use your Raspberry Pi as if you were working directly on the small computer.
Vnc Connect Download
Step 5: Looking at properties
You can access Properties from the menu at the top of the VNC Viewer preview window, but we’re going to close down the preview window to access it from VNC Connect. Click End Session in the drop-down menu and Yes to disconnect.
VNC Viewer now displays a small preview of your Raspberry Pi desktop in the Address Book, along with the IP address. You can double-click this at any time to reopen the connection – but first, right-click and choose Properties.
Enter ‘Raspberry Pi’ in the Name window; this will make your screen friendlier. Now click Options. The Picture Quality setting is set to Automatic by default. If you have a slow connection, try setting it to Low; alternatively, if you have a fast connection, set it to High.
Finally, take a look at the Expert tab. Here you can find a variety of settings for all aspects of the system. Scroll down to find FullScreen and set the drop-down menu below from False to True. Now when you open Raspberry Pi in VNC Viewer, the preview window will automatically be in full-screen mode. Choose the options you prefer and click OK to set them.
Step 6: Get online
So far we’ve been working on our local network. With a RealVNC account, you can access your Raspberry Pi across the wider internet.
Open VNC Viewer on your PC and click the Sign In button on the top left. It’s most likely that you don’t have an account already, so click ‘Sign up online’. This will take you to the RealVNC website.
Enter your email address and click the ‘I’m not a robot’ checkbox. Now create a password. Please choose a long and complex password that is not easy to guess. We suggest using a Diceware password generator (rempe.us/diceware). Follow the rest of the setup process and click on the email authentication when it arrives.
Step 7: Sign in
Now you need to sign in with the same account on both VNC Viewer on your PC and VNC Server on Raspberry Pi.
The Sign In window should still be displayed in the Sign In window in VNC Viewer on your PC. Open VNC Server on your Raspberry Pi and click Sign In to enable the cloud connectivity link (displayed just below your IP address under Connectivity).
Return to VNC Viewer on your PC. You’ll still see a Raspberry Pi window in the Address Book section, but below it you’ll see an option called Team (it will appear with your name). Click this to see your Raspberry Pi again. However, this is the connection using your VNC Connect account. Double-click it to launch into your Raspbian desktop and remote control.
Vnc Connect Free
The difference? This account works remotely, and you can use this from other networks.
Step 8: Send files
You can send and receive files from your Raspberry Pi and PC. We’ve created a blank test document in our Documents folder called test.txt.
To send the file to your Raspberry Pi, access Raspberry Pi using VNC Viewer. From the VNC Viewer preview window, click the menu at the top of the screen and choose Transfer Files.
Now click Send Files in the VNC Viewer – File Transfer window. Use the file picker to choose a file on your PC and click Open. The file will be sent to the desktop of your Raspberry Pi. A File Transfer window will appear with ‘Download complete’; close it.
Step 9: Retrieve files
You can retrieve a file from your Raspberry Pi using VNC Viewer, although the process is slightly different. This time, right-click the VNC Server icon in Raspbian’s menu bar. Choose File Transfer from the drop-down menu to open the VNC Server – File Transfer window.
Click Send Files and choose a file on your Raspbian file system. Click OK to send the file to the desktop on your Windows PC.
Your Raspberry Pi is now set up for remote access. It’s now perfectly possible to remove the screen and keyboard from your Raspberry Pi and leave it on the network. It’ll be there waiting for you to connect from your PC whenever you're ready.
Step 10: Android and iOS
It is also possible to connect to Raspberry Pi remotely from your smartphone. Use the VNC Viewer app for Android or iOS – download it from the Google Play Store or Apple App Store. Open and sign in using your VNC Connect account email and password.
You will see your Raspberry Pi under the Team menu. Click it and enter the username and password for your Raspberry Pi.
When it first launches, you’ll need to run through the ‘Control the computer’ process. Click on Next and it will open the ‘How to control’ window. This screen outlines how to perform gestures such as mouse clicks from the touchscreen. Close this window and start using Raspberry Pi from your phone.
Use the touchscreen to move the pointer around. A virtual keyboard is accessed by tapping the Keyboard icon at the top of the app window.
You can now access Raspberry Pi from anywhere, including your phone. A great solution for remote monitoring.
Top tip 1: Technical information
You can find a wealth of detailed information on the RealVNC website. Take a look at this Technician’s Guide PDF: magpi.cc/JiSeZX
Top tip 2: Got a Mac?
Vnc Connect Download Windows 10
Mac users must change the Authentication protocol to VNC password to connect using macOS’s native tools.