Remote connection to Department machines
CSSE offers access to linux.cosc.canterbury.ac.nz from off campus over SSH and also graphically via Remote Desktop. SSH opens a variety of access methods offering not only command line access, but a secure way of getting access to your files. These various methods are described below.
If you need any assistance with these remote access instructions please send an email to firstname.lastname@example.org
Alternatively, you have the option of running a Virtual Machine called LabBox at home on your own computer. LabBox contains most of the software used for course work in CSSE courses. You can read more about that here.
If you need access to central services from off campus, check with the ICTS help desk (03)369-5000 or on extension 95000. The central IT help page can also offer assistance.
Basic SSH Access
A command line interface to linux.cosc.canterbury.ac.nz on the default port 22 can be easily obtained from a terminal on Linux, MacOS and Windows 10 using the ssh command. Here's an example connecting from a Windows 10 PowerShell using the student usercode abc123:
PS C:\Users\Bob> ssh email@example.com The authenticity of host 'linux.cosc.canterbury.ac.nz (184.108.40.206)' can't be established. ECDSA key fingerprint is SHA256:p0tp9OpA0IW2bTuTa5FDIiFVETepeQlluL+RAWQhNfY. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'linux.cosc.canterbury.ac.nz,220.127.116.11' (ECDSA) to the list of known hosts. firstname.lastname@example.org's password: 9 updates could not be installed automatically. For more details, see /var/log/unattended-upgrades/unattended-upgrades.log Last login: Mon Apr 20 15:51:04 2020 from 18.104.22.168 [abc123@cssecs5 ~]$
Substitute abc123 with your own usercode when using the above command and type in 'yes' when prompted. Use exactly the same command when using Linux or MacOS.
If you're using Windows 10 and the SSH command appears to not work, it may not be installed yet. It's easy to install, just follow these instructions to do it from the GUI or do the following from a PowerShell window as Administrator:
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
And you should get this as output, indicating it went well:
Path : Online : True RestartNeeded : False
For students running Microsoft Windows, the University of Canterbury can provide the Education version of MobaXterm. You can download MobaXterm Education Edition from here. You must login with your University credentials in order to download the installer file. Documentation for MobaXterm is available here.
If you need to access a service or resource on a computer that by default is not directly accessible from off campus, you can create an SSH tunnel. A tunnel can be easily created from a terminal window in Linux or MacOS or a Command Prompt/PowerShell in Windows 10.
The following example creates a tunnel to a database server called db2.csse.canterbury.ac.nz on the official MySQL port 3306 while using linux.cosc.canterbury.ac.nz as the gateway/entry point. It also creates local port 1234 on your computer which you can use to access the destination computer:
tstark@jarvis:~$ ssh email@example.com -L 1234:db2.csse.canterbury.ac.nz:3306 -N
After authentication it might appear that the connection has hung because you don't see a command prompt. The tunnel is indeed open, but this effect is a result of the -N parameter. The tunnel will remain open until you type Control-C on the keyboard. If you remove the -N parameter from the ssh command you'll get a command line prompt on linux.cosc.canterbury.ac.nz while the tunnel is open. Typing exit will log you out and close the tunnel.
Note the example above uses a local port of 1234. You can change this number to some other port number that's above 1024 and isn't currently being used by some other service on your local computer.
With a tunnel created you can connect to it from another terminal with a command like this:
tstark@jarvis:~$ mysql -u DBUSER -p --port 1234 -h localhost DBNAME
DBUSER would be the user to use to connect to the database server with, and DBNAME is the name of the database.
While a little more initial setup is usually required with X2Go, it is worth using this over Remote Desktop. Instructions for setting up X2Go are on a separate page.
The Remote Desktop protocol is available with linux.cosc.canterbury.ac.nz. This particular service is not without some issues and while we offer it, X2Go is the preferred method for establishing a GUI connection.
Should you have connection issues where the windows appears blank, change the number of colours on your connection to 16-bit.
With Linux you can use rdesktop (you may have to install it first) to connect, like this:
tstark@jarvis:~$ rdesktop -u abc123 -g 1280x1024 linux.cosc.canterbury.ac.nz Connection established using SSL.
This will open a connection to linux.cosc.canterbury.ac.nz using the usercode abc123 with a screen resolution of 1280x1024. rdesktop has a bunch of other parameters you can use, see rdesktop --help from a terminal window for more information. You can for example change the screen resolution of the connection to be 80% of your own display by using -g 80%.
Instead of using rdesktop you might like to consider using Remmina with its rdp plugin. This GUI based application makes it easy to connect to remote computers using a variety of different protocols. It should already be in your distribution's repositories or you can grab the latest version from here.
MacOS users can obtain Remote Desktop from the Mac App Store.
Windows users can use the built-in Remote Desktop client or MobaXterm for example.
Running Applications Remotely - X11 Forwarding
There might be circumstances where you want to run an application on linux.cosc.canterbury.ac.nz but have the output of that application appear on your computer. This process is known as X11 forwarding.
With Linux this is easy to do because the software is already there. From a terminal window use the same ssh command as described above with Basic SSH Access, but add in the -Y parameter like this:
tstark@jarvis:~$ ssh -Y firstname.lastname@example.org
This will connect to the remote server the same as before, but this time you'll be able to run applications. e.g
[abc123@cssecs5 ~]$ xeyes &
The xeyes application will run on the remote computer but you'll see the graphical output on your desktop. You'll also get back control of the terminal - the effect of the & at the end. If you find your connection is slow, change the -Y to -YC which will turn on compression.
To use X11 forwarding on a Mac you first need to install XQuartz. Once installed, keep it running at the same time as you run the ssh -Y ... command above.
For Windows users, MobaXTerm includes a built-in XServer and will by default automatically forward X11 applications to your client.
Remote Access to Files
You can access and edit files that are in your CSSE home directory over a command line SSH connection as described in Basic SSH Access and use text editors such as nano and vi for editing. But you can also access and edit files by remotely mounting your CSSE home directory on your computer. Depending on how good your connection is, this technique may only be good for working with smaller files.
Linux and MacOS
The method for Linux and a Mac is the same, but on a Mac you first need to install FUSE and SSHFS, or if you have Homebrew installed this will get it too:
$ brew cask install osxfuse $ brew install sshfs
On Linux make sure the package sshfs is installed.
Then you can mount your CSSE home directory from a terminal window and make it locally accessible in a directory called remotefiles, like this:
tstark@jarvis:~$ mkdir remotefiles tstark@jarvis:~$ sshfs email@example.com: ./remotefiles
The mkdir command only needs to be done the first time you set this connection up. When you have finished with the mount you can disconnect it with one of the following two commands:
fusermount -u ./remotefiles umount ./remotefiles
For Windows there are a few options available. Here are some examples:
There is good documentation for showing you how to map a drive graphically or via a command prompt once you have WinFSP and SSHFS-Win installed.
Alternatively, MobaXTerm will by default start a SFTP or SCP connection when you connect to an SSH session. Your files will be shown in the side-bar beside the Terminal window.
To the main page for CSSE Computer Labs.