pete > guides > department machines


This page describes software used to access Linux machines operated by the Middlebury College Computer Science Department. These are not machines that we can walk up to and look at, or whose keyboard we can physically poke; they must be accessed over the Internet. Usage of these machines usually falls into two categories: interacting with a shell (the text-only interface, to run programs on that machine) or transferring files (eg, to build a website or submit a solution for a class). Instructions for how to perform these operations from various operating systems follows. There are also instructions for editing files remotely (eg, using an editor such as VSCode or SublimeText running on your own computer to edit files stored on one of the department Linux machines).

NOTE The instructions below refer to a username and password. In every case, the username is the part of your Middlebury email address before the "@" sign and the password is the same password you use to access your Middlebury email account.

NOTE For any of this to work, you must either be on-campus (and connected to the MiddleburyCollege wireless network or a wired Ethernet connection) or be using the VPN.

NOTE For Windows users, modern versions of Windows include all the necessary programs. If you follow the instructions and you run into problems with programs not being found, please let us know and we can work with you on a solution.

Table of contents:

Shell access (ssh)

The program ssh establishes a secure, encrypted connection over the Internet to another machine and runs a shell on that other machine. Once the connection has been established, any commands typed into the terminal with be executed on the remote machine, and anything printed by programs run on the remote machine will be shown in the terminal. All three major operating systems (Windows, OS X, Linux) ship with the ssh program, which can be run from the command line running within a terminal emulator.

Summarized: you will run a terminal emulator on your machine; you will run the ssh program from within that terminal to connect to the remote machine; anything typed will be sent to the remote machine.

To open a terminal emulator…

On Windows, click the Start button in the bottom left and, in the search bar, type "cmd" and press Enter.

On OS X, click the search bar, type "Terminal", and press Enter.

On Linux, there are too many possible paths to document, though it is likely a very front-and-center feature. Ask your professor or a course assistant for assistance.

Running ssh

Once you have the terminal emulator open, you should see a prompt.

On Windows, it probably looks like this:

C:\Users\username>

On OS X, it probably looks like this:

username@hostname ~ %

On Linux, it probably looks like this:

[username@hostname ~] $

Fortunately, the ssh program behaves the same way on all three platforms. In the following example, replace "username" with your username and replace "machine" with the name of the machine to which you wish to connect; "basin" is the most likely choice at present. Type it and press Enter.

ssh username@machine.cs.middlebury.edu

Whenever you connect to a machine for the first time, ssh will yell at you that it doesn’t recognize the machine to which it is connecting:

The authenticity of host 'basin.cs.middlebury.edu (140.233.20.10)' can't be established.
ED25519 key fingerprint is SHA256:lhM7T/e496U+TQlUi1iZNEjOgM2Uoscy9PVKDVTQCI4.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])?

Type "yes" and press Enter. (You should only have to do this once for each machine you connect to. And yes, I probably shouldn’t recommend that you just blindly agree here, but it’s what happens most of the time in the real world, so there you go.)

You will then be prompted for your password. Type the same password you use to access your Middlebury email and press Enter. You may not see any output to indicate that it’s actually receiving the characters of your password. That’s okay! This is a security measure to ensure nobody even knows the length, let alone the content.

When you have succeeded, you will see a new prompt printed out that tells you it’s on basin:

[username@basin ~] $
When you’re done

When entered at the shell prompt, the commands "exit" and "logout" will terminate the shell session. The original OS-specific prompt will now be printed because ssh is no longer running, and you’re no longer connected to the remote machine.

Copying files (using the shell)

You will once again need to open a terminal emulator (see the previous section for instructions to do so). Instead of running ssh, however, you will use one of its siblings, scp. The scp program expects two command-line arguments: where to copy the file from and where to copy it to, usually named the "source" and "destination". If you want to copy a file from a remote machine to your local machine, then the source will be some place on the remote machine; if you want to copy a file from your local machine to a remote machine, then the destination will be on the remote machine. In both cases, you will need to identify the path on both the local and remote machines: that is, the location of the file within the folder/directory hierarchy.

For all operating systems, the basic structure of the command looks like this:

scp source destination

Either source or destination can be remote, but not both. Remote locations are specified with this syntax:

username@machine:path

Note that a relative path here is relative to your home directory; an absolute path is still absolute.

As a complete example, let us assume there is a file called "homework.txt" in my home directory on basin. To copy it to my local machine, I open a terminal on my machine and run the following:

scp username@basin.cs.middlebury.edu:homework.txt .

Here, a destination of "." means "the current directory" (on the local machine).

Likewise, if I want to copy a file from my local machine to the remote machine, I would use a command like this:

scp /Users/william/Classes/Fall-1066/Invasion-of-Normandy/essay.docx william@basin.cs.middlebury.edu:

(A more advanced solution is to use rsync, but that is beyond the scope of this documentation. It is especially useful for transferring large files or lots of files, because it only copies the files/parts that have changed. Investigate it on your own or ask a course assistant or professor for help.)

Copying files (using the GUI)

[Note that all these examples use "basin" as the machine name. This is intentional, as your home directory—that is, where your files are stored—is shared between all department machines. So if you follow these instructions to copy files to basin, those files will be available on all department machines.]

On Windows, click the Start button. In the search box, type "\\basin\username" (where "username" is your username) and press Enter. A window should appear asking for your username and password; enter them and click Ok. A File Explorer window should appear showing the contents of your home directory. You may drag and drop files as normal and they will be copied to/from the remote machine.

On Mac, open the Finder. Open the Go menu. Select "Connect to Server". A window should appear; in the "server address" box, type "smb://basin" and click Connect. A window should appear asking for your username and password; enter them and click Ok. A Finder window should appear showing the contents of your home directory. You may drag and drop files as normal and they will be copied to/from the remote machine.

On Mac, if you’ve previously followed the preceding instructions, you may find that they do not work anymore. In that case, open the Finder, open the Go menu, navigate to the Recent Folders submenu, and find the item whose label matches your username (it will probably also have a different icon suggesting a remote folder as opposed to a folder stored on your machine). Click it and a Finder window showing the contents of the folder should appear. If any step of this fails, talk to the course staff and we’ll see what we can do.

On Linux… it varies. Consult your distribution’s documentation on mounting remote filesystems. The protocol name is "cifs", the hostname will be "basin", and the username and password should be as specified at the top of this page.

Editing files remotely

If you need to create and run programs on a department machine, this will likely involve a lot of the "edit/run/debug/edit more" cycle. One way to do this is to use the "copying files (using the GUI)" approach above and, instead of dragging and dropping files to copy them, just drag the file to your editor of choice. Another way is to store the files on your local machine, edit them using a program like VSCode or Sublime Text running on your local machine, copy them (using shell or GUI, as described above) when necessary to the remote machine, and have a terminal window open, running ssh connected to the remote machine, to run/debug them on the remote machine. This can be cumbersome.

Many modern text editors present an alternative: they can be configured to use scp for you, in which case you need to tell it the name of the remote machine, the path of the file to edit on the remote machine, and your username.

Here are Microsoft’s instructions on setting up remote editing in VSCode: https://code.visualstudio.com/docs/remote/ssh

Instructions for setting up remote editing in Sublime Text are forthcoming.

For other editors, consult the documentation (and share what you find with us so we can add instructions here!).

Last modified: