Lab 2 - Directories, Files and SFTP CSE/INFO 100, Autumn 2005 Lab

Lab 2: Directories, Files, and SFTP

Key Words: file, directory, folder, directory structure, local computer, remote computer,dante, SFTP, root directory, home directory, public_html, student_html, upload, download.

Objectives

From this lab, you will learn how to store on and retrieve files from a remote computer named dante.

For this course, you are required to publish all of your completed assignments (homeworks, labs, and projects) on the web, with certain exceptions. This means that you will be required to place all of your files on dante and have your web publishing area activated. If your web publishing area is not activated or if you do not know if it is activated, complete Lab 1 before continuing with this lab.

In general, you should not use floppy disks for your assignments. They are unreliable and have a tendency to become unreadable when you need them the most! Instead, use a reliable remote computer (such as dante) to store your important data. You have been given 100 MB of disk space on dante, which should be more than sufficient for this course.

A directory is often also called a folder.

Navigate through a Directory Structure on the Local Computer

To be able to find directories and files on your local computer, you must understand how to navigate through the computer's directory structure. This section explains how to navigate through a Windows environment on the local computer.

The local computer is the computer your keyboard is physically attached to.

  1. Open Windows Explorer (not Internet Explorer). You will use Windows Explorer on the local computer to navigate through its directory structure.

    You can open Windows Explorer using one of the following methods:

  2. Go to a directory such as C:\Documents and Settings\YourUWNetID\My Documents, substituting your UWNetID where applicable. If you are not on a UW lab computer, you may open some similar folder instead.

    C:\Documents and Settings means a directory named Documents and Settings on a hard disk drive named C.

  3. Create a directory. From the menu bar at the top of the window, select File>New>Folder. Call your new directory EraseMe.

    Creating a new
directory

  4. Go to your newly created directory EraseMe. The directory should be empty.
  5. Open Notepad. You will use it to create a new file. Notepad can be opened in several ways:
  6. Write a few lines of text in Notepad and save the file as testFile.txt inside your EraseMe directory. Remember where the file is located as you will need it later in this lab.
  7. The following is a visual representation of C:\Documents\EraseMe\testFile.txt on a local computer.
    Windows Explorer showing the
directory structure Simplified directory structure
icon
    Windows Explorer showing the directory structure Simplified directory structure
    The beginning of the directory structure is called the root. In this case, the root is C:. (The Desktop is actually a directory on the hard disk drive named C. My Computer is not a directory and, therefore, can not be the root of a directory structure. It is Microsoft Windows method for grouping together the different parts of the local computer.) Other root directories on the local computer are A: (for the floppy disk drive) and D:, if it exists.

Navigate through a Directory Structure on a Remote Computer

To be able to find directories and files on a remote computer, you must understand how to navigate through the remote computer's directory structure. This section explains how to navigate through a UNIX environment on a remote computer named dante, using a graphical SFTP program named SSH Secure File Transfer.

SFTP stands for Secure File Transfer Protocol, which is a standardized method (protocol) for transferring files between computers in a secure/encrypted manner.

A remote computer is a computer that you can access (e.g., through a computer network like the Internet), and is not the computer your keyboard is attached to.

  1. Start SSH Secure File Transfer SFTP icon, which uses SFTP.
  2. Click on the Quick Connect button.

  3. A window named Connect to Remote Host will pop up. For the host name, enter dante.u.washington.edu and for the user name, enter your UW NetID. If your UW NetID was smith, you would enter the following:

    SFTP
connect dialog

    Enter your password in the next pop-up window to finish connecting to dante.

  4. You should now see a divided window showing some files and/or directories. The local computer's files and directories are shown on the left while the remote computer's files and directories are shown on the right. At the top and the bottom of the window you can see which computer you have connected to, in this case, dante. In the smaller window on the right, you can see the entire directory path of your current location on the remote computer, e.g., /nfs/guido08/smith. (When you first connect, you will always start in your home directory, which should have the same name as your UW NetID.) There is a similar small window on the left, which corresponds to the directory path of your current location on the local computer. It should currently be empty.

    SFTP dialog

    The gray bar located at the bottom of the window is the status bar. It tells you if you are connected to a remote computer, which computer you are connected to, etc.

    You can learn what an icon represents by positioning the mouse over the icon.

  5. We are now going to work with the web-accesible directory within your home directory. IMPORTANT: If you have both a student_html and a public_html, then use student_html in this class. If you only have public_html, then use public_html.

    Your public_html or student_html directory is a web accessible directory. This means that anyone can view the contents of this directory through the web using a web browser. So this directory is where we are going to put all the files you wish to be displayed on the web, for your personal website. For anyone to look at your website, they simply need to go to http://students.washington.edu/yourUWNetID/ (replacing yourUWNetID with your own UWNetID, of course).

    Open your public_html directory or your student_html directory on the remote computer by double clicking on it. If this directory is empty, the right window should become empty.

    If you go down into the wrong directory, you can go up and out of it by clicking on the Up icon .

  6. Create a new directory named fit100 inside of your public_html (alternatively student_html) directory. You can use one of following methods:

    Your fit100 directory is the directory where you should put all of your assignments for this course.

  7. Create an additional directory inside of your fit100 directory. You will need a directory for this lab, which should be named lab2 (since the lab is called Lab 2). Thus, your home directory should have the public_html (or student_html) folder, and inside it, there should be the fit100 folder, and inside that, there should be the lab2 folder.

  8. You can see your files online in a web browser as well. Open up Firefox or Internet Explorer, and type in your UW homepage URL, followed by fit100 (http://students.washington.edu/yourUWNetID/fit100). You should see a list of everything you have inside your fit100, which right now will be only your lab2 folder. You can click on it to see what is inside the folder (which now should also be nothing). To go back up the directory structure, just click Parent Directory.

Move Files from the Local Computer to a Remote Computer and Vice Versa

To make your assignments web accessible, which is required for all completed assignments in this course, you must place them in your web accessible directory on dante.

This section covers how to upload and download files and directories to and from a remote computer.

Upload means to transfer files/directories from your local computer to a remote computer (local –> remote). Download means to transfer files/directories from a remote computer to your local computer (remote –> local).

  1. Go into your lab2 directory on dante, which should be in your fit100 directory.
  2. Using the left half of SSH Secure File Transfer, navigate to where you placed testFile.txt on your local computer by double clicking on the appropriate directories. (Start by double clicking on My Computer.) Your file should be located in the EraseMe directory.
  3. Upload your testFile.txt file to your lab2 directory on dante. This can be done by using one of the following methods: You can upload entire directories using the same method.
  4. By uploading your file, you have sent a copy of your file from the local computer to a remote computer. If you look in the Transfer tab in the SSH Secure File Transfer window, you will see the status of your file transfer.
  5. Download testFile.txt from the remote computer back to your local computer. This time, place it in a different directory on your local computer, for example, directly in the root directory of C:\.
  6. Using SSH Secure File Transfer, practice creating, renaming, and deleting directories on both the local and remote computers, as well as uploading and downloading files and directories. Also practice looking at them on the web. These are skills you will need throughout the rest of this class, so make sure you've got it down.

When you are done, close all SSH windows to log out from the remote computer. Finally, log off the local computer before leaving.

Check List

You do not need to submit anything when you have completed this lab. However, you must be able to perform these skills in future assignments.