Digital humanities


Author: Janis Chinn (jec115@pitt.edu) Maintained by: David J. Birnbaum (djbpitt@gmail.com) [Creative Commons BY-NC-SA 3.0 Unported License] Last modified: 2016-01-24T19:23:12+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 SSH Secure Shell Client 3.2.9 and on MacOS we use the built-in command-line ssh application for SSH and Fetch for SFTP. Linux comes with both command-line ssh and command-line sftp 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.

Logging In

Once you've installed your client, open it and click on the Quick Connect button (see below). This will pop open a dialog box for you to fill in. 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, there’s a drop down menu for the Authentication Method, which you should set to Password. We’ve filled all this in below (with the exception of the port number, as discussed). When you’re done, click the Connect button.

Connecting to Obdurodon

This will prompt you to enter your password (the one you chose when your obdurodon account was created) in a new dialog box and click OK.

Using the Client

The first time you log in, another dialog box will pop up asking you to add a profile. You only have to do this once, after which, in the future, you’ll be able to select the profile from the Profiles menu, and you won’t have to type the host name, username, port, etc. manually. This first time, though, enter a name for your new profile (we call ours obdurodon) and click Add to profiles. This dialog box will disappear after a while if you don’t click on anything, but you can click the Profiles button to reopen it.

Adding a Profile

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 SSH Secure Shell (that is, if you are on a Windows machine), you must make the configuration changes described at the top of our syllabus page. You only have to do this once.

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. Click the Window menu and select New File Transfer or click on the button indicated below.

Opening a File Transfer Window

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://www.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://www.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://www.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 File menu by picking Disconnect, you can click the button that looks like a computer with a red line through it, or you can hold down the control key and type the letter d. After that, you can close the window as usual.

Disconnecting

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@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 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://www.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@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.