Tutorial: UNIX & SSH Secure Shell

I. Working with the UNIX Command Line from SSH Secure Shell

garnet.acns.fsu.edu, like most Web servers, uses the Unix operating system. Unix systems are maintained and manipulated using a command line interface. This lesson is designed to teach you the basics of managing your Web site from the Unix command line.

  1. Connecting to garnet.acns.fsu.edu with SSH
    • SSH is available on all campus computers and free to download at ftp://ftp.ssh.com/pub/ssh/ (download the file named SSHSecureShellClient-3.2.9.exe).
    • Use the "SSH Secure Shell Client" to connect to garnet.acns.fsu.edu
  2. Accessing the UNIX prompt
    • Once logged on choose "12. UNIX prompt"
    • Note: your mouse and arrow keys are useless in an SSH connection. Type 12 and press Enter to select menu item 12.
  3. Differences between UNIX and Windows file systems
    • The obvious: UNIX uses a command line interface
    • What Windows calls folders, UNIX calls directories
    • UNIX uses / rather than \ when specifying file locations - that's why URL's use forward slashes
  4. Creating and editing text files using Pico
    • type pico at the command line and press Enter to start the Pico text editor
    • Type your name in the text file.
    • Exit and save the file as practice.txt
    • Note the available commands at the bottom of the window - the ^ symbol represents Ctrl - so Ctrl+x will exit the program and take you back to the UNIX prompt.
    • You can use pico to edit your web page files on the server.
  5. Viewing the file system with UNIX commands.
    Command Effect
    pwd displays your location within the file system
    When you login, you are automatically placed in your home directory
    ls lists contents of current directory

    Try out the above commands at the UNIX prompt. Type the command and then press Enter,
  6. Creating, removing, and moving around folders.
  7. Command Effect
    mkdir <dirname> makes a new directory in the current directory with the name that you specify (replace <dirname> with the name of the new directory)
    rmdir <dirname> removes the directory specified
    cd <dirname> change directory to specified directory name replace <dirname> with the name of the directory you wish to change to.
    cd ..

    move up one directory level

    Note one dot (.) refers to the current directory, two dots (..) refers to the directory one level up.

    cd ~ takes you back to your home directory - just cd would work as well - the tilde character (~) represents your home directory

    Try creating a directory and then move around the file system using the cd command.
  8. Copying, moving, renaming, and deleting files and folders.
    Command Effect
    cp <filename> <newfilename>

    copies filename to newfilename
    If copying a file to a new location, first cd to the new location then use the the path of the original file. Note that .. (two dots) is used to represent on directory up the hierarchy, and . (one dot) represents the current directory. Consider the following command:
    cp ../myfile.html .

    mv <filename> <newfilename> like the copy command but this command moves filename to newfilename. Note: also use mv to rename files
    rm <filename>

    removes the file specified by <filename>. REMOVAL IS PERMENANT!

    Experiment with copying and moving your practice.txt file to and from different directories.
  9. Setting file and directory permissions.
    Command Effect
    ls -l

    detailed listing of content
    note the -rw-r----- listing for each file
    r =read, w=write, x=execute
    Three groupings for
    user, group, and others.
    rwx rwx rwx would mean that everyone could read write and execute this file (dangerous).
    is the standard for web pages
    Web page directories and image files use rwxr-xr-x
    The default for new files is
    nice and safe.

    For more on permissions see this tutorial.




    chmod <specs> <filename>

    changes permissions of filename to specs.
    specs includes u, g, or o to specify user, group, or others, + or - to add or remove permissions and r, w, or x to specify read, write, or execute. For example o+r means grant others the permission to read the file.

    chmod 644 <webpage_name>
    sets web pages to the correct permissions
    chmod 755 <directory_name>
    sets webpage directories and images to the correct permissions

    The explanation for the 644 and 755 requires knowledge of binary numbers.

    Set the permissions of your practice.txt file so that others can read it but not write to it.
  10. Delete all files and directories that you created in this exercise.

Additional helpful unix commands

Command Effect
bash Switches to a more convenient shell (user interface) that allows you to call previous commands with the up arrow, and auto-complete file and directory names with the tab key.
ls -al

A long list of all files in the current directory. Even hidden files.


ls -al | more

| more uses the "pipe" symbol )long vertical line that shares a key on the keyboard with the \ symbol) and prints long lists of file contents one page at a time. Progress through pages using the space bar.

For more information on using Unix see http://www.acns.fsu.edu/docs/unix_index.html or any of the hundreds of Web sites and books dedicated to the topic.

II. Working with Secure File Transfer Client

Web pages and Web sites are typically created on the developer's own PC and then transferred to the Web server once they are finished. Web developers maintain two copies of their Web sites: one on their local PC for development, and another on the Web server for viewing by the public. SSH Secure Shell software includes a second program called Secure File Transfer Client that is ideal for transferring files between your PC and garnet.acns.fsu.edu.

  1. In the SSH Secure Shell folder launch the application names Secure File Transfer Client.
    • You will see your local file system displayed in the left window.
  2. Use Quick Connect to connect to garnet.acns.fsu.edu using you FSU username and password.
    • Your file system on garnet will be displayed in the right window.
  3. You can navigate through either file system by double clicking the folder icons.
  4. Files can be transferred from one system to the other by simply clicking and dragging from one window to the other, or by using the arrow buttons, or menus.
  5. You can set Unix file properties, such as read/right/execute permissions by right-clicking files and folders and selecting properties from the shortcut menu.
  6. Once transferred, files can be further manipulated using SSH


  1. Type cd at the UNIX prompt to return to your home directory. Use pwd to confirm that you are in your home directory.
  2. Use the following command to make your home directory viewable to the world: chmod 755 . (include the period at the end)
  3. Use ls -al to check that your home directory (.) has permissions rwxr_xr_x
  4. Create a directory named public_html (all lower-case) in your home directory
  5. Change the permissions of public_html to 755
  6. Use Firefox or Internet Explorer to view http://garnet.acns.fsu.edu/~your_username
    • If you get an error you made a mistake above. A "Forbidden" error means you didn't change the permissions of your home directory and/or public_html correctly. A not found error indicates that you did not create public_html in your home directory, or perhaps you mis-spelled it or left out the underscore character or used upper case characters.
  7. Use Firefox or Internet Explorer to download one of the images at http://service.cs.fsu.edu (right-click the image and save to your PC).
  8. Use Secure File Transfer Client to upload the image file from your PC to your public_html folder on garnet.
  9. Use Secure File Transfer Client to change the permissions on the image file on garnet to 755.
  10. View the image file by using your Web browser to go to http://garnet.acns.fsu.edu/~your_username and clicking the file name.