Table of Contents

Update August 21, 2024

VNC Virtual Network Computing

These directions are for remotely connecting to a Linux computer using a VNC server.

Must have a good internet connection in order for it to not be extremely slow, but note that the school's VPN may be the issue if connection is really slow.

We will be using the RealVNC program, which includes the VNC Viewer and the VNC Server.

First Time Access via VNC to UND Linux Servers (Aircraft/Littlestorm)

  1. A secure shell client is required.
    1. On Windows, use PuTTY.
  2. Most likely will need to access UND vpn. UNDvpnInstructions
  3. Type vncpasswd in PuTTY to create a password file in ~/.vnc
  4. Email SCC, Dere Stinchfield derek.stinchfield@und.edu to start VNC using Window listed at end of page.
  5. Use VNC viewer to access the site. (May need to be downloaded). Name: RealVNC Viewer.
    1. Use new VNC password created in step 1. Then, login using personal ndus password.

* Simplified steps for future use after initial set up:

  1. Activate UND vpn through Global Protect.
  2. Open PuTTY and login.
  3. Open RealVNC Viewer and login.

Creating a VNC file on Remote Linux Computer

  1. You must first create a vnc file on the computer you are wishing to gain external access to (the server computer).
  2. Make sure you add this file to /home/<username>/.vnc/
  3. To make the new file (an xstartup file), paste the sample code below into a text file.
  4. After you have created the startup file, go to a terminal window and type vncpasswd, next enter the password you would like to use when accessing the server computer. (This will only be your VNC password when you are starting VNC)
  5. In a terminal window type in vncserver to start the server. More information and functions about starting and killing the server in the Extra Information section of this page.
  6. Make sure this file is executable. If not, make executable by typing chmod +x xstartup in terminal window

xstartup code for RedHat Linux Computers (for example aircraft.atmos.und.ued)

See /nas/setup/xstartup-aircraft. Put the below “code” in .vnc/xstartup using editor or cp. For example, cp /nas/setup/xstartup-aircraft ~/.vnc/xstartup

#!/bin/sh

vncconfig -iconic &

#Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey 
vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &
#IF YOUR NOT ABLE TO OPEN A GNOME TERMINAL IN YOUR VNC SESSION, COMMENT OUT THE LINE ABOVE AND UNCOMMENT OUT THE LINE BELOW!
#exec gnome-session &
0

xstartup code for Linux Mint Computers (for example Clifford Hall 422 computers)

#!/bin/sh


# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
mate-session &

xstartup code for Ubuntu (for example Calgary)

#!/bin/sh

#Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey 
vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
mate-session &

Starting and Killing the Remote Linux VNC Server (Can't do on Aircraft/Littlestorm)

#!/bin/bash
# Shell Access Aircraft using vnc client
export VNC_VIA_CMD='/usr/bin/ssh -2 -c aes128-cbc -x -p 22 -f -L %L:%H:%R %G sleep 2'
/usr/bin/vncviewer -FullColor -passwd ~/.vnc/passwd -via aircraft.atmos.und.edu :1
ls ~/.vnc/*.pid
computer_name:1.pid
ps -ef | grep -i Xvnc

VNC into Calgary

Do the same steps as above, however in your 'vnccalagary' file on your home server, you must input the following. NOTE: You may need to change some of the contents in this file such as your <user.name> and what server number.

#!/bin/bash
# Shell Access Aircraft using vnc client
export VNC_VIA_CMD='/usr/bin/ssh -2 -x -p 22 -f -L %L:%H:%R %G sleep 2'
/usr/bin/vncviewer -FullColor -passwd /home/<user.name>/.vnc/passwd -via <user.name>@134.129.222.140 :1

Also, you need to use the xstartup code file for Calgary which is displayed underneath the xstartup code for linux mint machines.

Accessing the VNC server using Windows Operating System

Downloading RealVNC VNC Viewer

  1. Select your OS and click Download VNC Viewer
  2. Install as you would normally per your OS

Setting Up VNC Viewer on Windows (Putty)

1) Connect to the campus' VPN

2) Use PuTTY or the like to connect to the computer you want to remotely access

3) Start the VNC server as described in the Starting and Killing the Remote Linux VNC Server section and take note of the display number you are assigned

  New 'computer_name.atmos.und.edu:1 (username)' desktop is computer_name.atmos.und.edu:1

4) Exit out of PuTTY while keeping the previous terminal open, reopen PuTTY, and type the following:

5) Open VNC Viewer and type into the VNC Server box: localhost:?? where ?? is the display number assigned to you

Accessing the VNC server using Linux Terminal

You can access vnc through a Linux (i.e. Redhat) terminal window with the following command:

vncviewer -via <IP address> :<display number>

With the case of esxfedoralo, it would be the following command:

vncviewer -via 134.129.214.58 :<display number>

Other things you will need

Extra Information for those interested

Terms and Definitions

Accessing the VNC server on OS X

OS X has a built in VNC viewer, so no extra software is needed to access the VNC server.

To access the VNC server: — David Delene 2020/10/19 23:12

To change the VNC viewer resolution:

List of VNC Display Numbers Used by People

To allow scripting to access VNC, people may want to use the same display number, Hence, below is list, please add your name and number. Please use vncserver :? where ? is your display number.

* Active Users

To see who is using VNC Server session use the command “ps -ef | grep -i Xvnc”. This can also be used to check if your own session is running. To kill a session use vncserver -kill :? where ? is your display number.

- Error Example: Attempting to run vnc, you may get the error 'Timed out waiting for a response from the computer.' Use above command to check your session. If your session is not running, email Derek.Stinchfield@und.edu to start session.