Digital humanities


Maintained by: David J. Birnbaum (djbpitt@gmail.com) [Creative Commons BY-NC-SA 3.0 Unported License] Last modified: 2021-08-17T17:33:01+0000


Putting content on line

Introduction

This tutorial describes how to upload content to your websites, which you will need to do for both a few homework assignments and your project.

The first step is to install some variety of SSH/SFTP (secure shell and secure file transfer protocol, respectively) client. On Windows we use PuTTY for SSH and WinSCP for SFTP, and you can download both from https://www.technology.pitt.edu/software/student. On MacOS we use the built-in command-line ssh application for SSH and Fetch for SFTP (students may obtain free licenses for Fetch at http://fetchsoftworks.com/fetch/free). Linux comes with both command-line ssh and command-line sftp commands built in, and does not require any third-party software. This posting features screencaps for Windows but the principle is roughly the same on MacOS. Linux users can view the required command lines here.

Changing your password

Before you do anything else, ensure that you have replaced the default password that we set up for you when we created your account with a strong password. Windows users will do this with PuTTY. You only have to do this once; once you’ve changed your password, the system will remember the new one.

Begin by entering the host name (dev.obdurodon.org) and port nummber (we’ll tell you this in class) and select Open in PuTTY from the dropdown next to the Login button. You will be taken to the PuTTY terminal. Under login as:, type your userid and hit Enter. Then, type your current password on Obdurodon and hit Enter. Note that it will look as if nothing is happening; this is a security feature, in case anyone is watching over your shoulder while you type. Next, type the command passwd and press Enter. Finally, type your current password, press Enter, and then your new password (you’ll be asked to do this twice). Here, too, even if it looks as if nothing is being typed, it's working!

Changing Password

MacOS users can log into the command-line to change their passwords with the ssh program by typing:

ssh -p port-number -l userid    dev.obdurodon.org

Replace port-number with the number we tell you in class and replace userid wth your own userid.

Logging in

Once you've installed WinSCP SFTP client (or Fetch on MacOS) and asked to start a connection, a login screen consisting of a dialog box will open for you to fill in (see below). Should you close the dialog box for any reason, click New Session, and it will reappear. The file protocol is SFTP. The host name is obdurodon.org, and the username is the name on your account on the server. For security reasons we do not publish the port number here (the number below, 22, is the standard one, but we use something different); we’ll tell you the actual port number in class. Finally, fill in your username and password in the appropriate fields. We’ve filled all this in below (with the exception of the port number, as discussed). When you’re done, click the Login button.

Connecting to Obdurodon

Using the client

Navigation in this SSH (secure shell) window (called a shell or command line session) is done using unix shell commands, a list of which you can find on line at http://mally.stanford.edu/~sr/computing/basic-unix.html. You don’t need to memorize all of these commands; you’ll probably need only a few of them for the limited work you’ll be doing here on the command line, and you can come back and look them up again if you forget. The commands we use most are ls, and cd, which list the files in the current directory and change directories, respectively.

Uploading files

If you use WinSCP, there’s not terribly much that you’ll need to do on the command line beside poking around between directories (which could be useful, if you want to see whether, for example, someone in your project group has uploaded a file you need). If you want to upload or download files, though, you’ll need to open an SFTP session. If you’re working on a Mac, you’ll need to open a different program (we use Fetch), but the Windows client that we’re using supports both SSH and SFTP, so it’s the only program you need.

The left pane is a view of your local files (My Documents and the like), while the right pane is a view of the files on Obdurodon. The right pane will open by default to your home directory folder. You’ll put files for your private web pages (such as homework assignments) in the public_html subdirectory of your home directory; you can double-click on the name to move into it. You’ll put files for your project in a separate project directory, and we’ll show you how to do that later.

The easiest way to transfer content between your local machine and obdurodon is to click and drag a file (or files) across panes to do either action.

The file system and URLs

Files live in directories on the obdurodon file system, but users access them through uniform resource locators (URLs), which are the web addresses we type in the address bars of our browsers. We’ll explain the relationship between file system locations and URLs later, but for now you should know that you should put personal (non-project) files in the public_html subdirectory of your home directory, and that the URL for a file called, say, myFile.xhtml that belongs to user jec115 would be http://dev.obdurodon.org/~jec115/myFile.xhtml. Substitute your own username and your own filenames for your own materials.

There’s one exception to the rule that visitors must know the filename in order to find a file because that name is part of the URL. Your main home page (whether in your personal directory or your project directory) should be called index.xhtml. The reason for this is that when you navigate to your directory and don’t specify any filename, the server knows to look for a file called index.xhtml. That is, a user who goes to http://dev.obdurodon.org/~jec115/ will automatically be taken to a file called index.xhtml in the public_html directory of user jec115. If there isn’t an index.xhtml file in that directory, going to http://dev.obdurodon.org/~jec115/ will generate an error message, and users will have to know the exact name of a file in order to load it.

Closing

When you’re all done, you can exit just close the File Transfer window as you would close any window on your computer, but you should disconnect from obdurodon before closing the SSH window. You can do this via the Session menu by picking Close Session, you can click the button that looks like a computer with a red line through it, or you can hold down the control key, shift key and type the letter d. After that, you can close the window as usual.

Closing

Instructions for Linux users

Open the shell by pressing ctrl + alt + T and browse to the directory where you keep your project files or homework (cd directoryLocation). Alternatively, you can install the Nautilus open-terminal package first by typing: sudo apt-get install nautilus-open-terminal (apt-get is for Ubuntu; other Linux distros may use alternative commands). This will allow you to open a terminal wherever you are by right-clicking and selecting Open in Terminal.

To upload files you have to connect through SFTP. To do that, type the following line, replacing XXXXX with the port number you were given in class: sftp -P XXXXX yourUserName@dev.obdurodon.org. Type your password when prompted to do so.

If you get an error message, the problem might be related to the default port number the client is listening to. To change it type: sudo gedit /etc/ssh/sshd_config and edit that information. Save it and type sudo restart ssh.

Once you have logged in, use the command line to go to the directory you want to upload files to. If you want to upload your homework, go to: cd public_html. If you want to access your project directory, browse instead to: cd /var/www/html/projectKeyword.

Since we opened the SFTP connection after positioning ourselves in the directory where we keep the files we want to upload, we only need to use the command put followed by the name of the file to upload it (remember that the extension is always part of the file name, so, for example, to upload file.xml you need to type put file.xml, and not just file). If the files you want to upload are in a different location, you’ll need to type a path to reach them. If you don’t know how to do that, ask an instructor, or just close the connection, navigate to the correct location on your system, and open a new connection from there.

In addition to the commands we’ve already used (cd to change directories and put to upload files), the most common ones are ls to list the files inside the current directory and rm followed by the file name to remove them. You can find a more complete list of available commands at http://mally.stanford.edu/~sr/computing/basic-unix.html.

To see the files you have uploaded to your personal subdirectory (that is, the homework you uploaded to your public_html subdirectory) in a browser, visit the URL: http://dev.obdurodon.org/~yourUserName/yourFileName.

Some actions, such as changing the permissions of a file or removing directories, must be done through SSH instead of SFTP. The command line you need to initiate an SSH connection is: ssh -p XXXXX yourUserName@dev.obdurodon.org. Notice that in SFTP we need to use an upper-case P to specify the port and in SSH we need to use a lower-case one.

To disconnect at the end of your session, type ctrl + D.