How to use ssh and sftp

The instructions on this page are geared to use by cpe101 students in the lab, so they explain the usual action in that environment: connecting from one of the Windows-based PCs to the central unix server, polylog1.calpoly.edu.

Contents

Connecting to a remote host (windows)

If you want to work on another machine over the network, you have to first connect to that machine, then log in so it will let you run commands there. The benefit of ssh over other remote login programs is that ssh encrypts the data it transfers so that eavesdroppers can't capture valuable information like passwords, credit card numbers, embarassing middle names, etc. In fact, ssh's name stands for Secure SHell.

To connect to a remote machine from a windows machine running ssh:

  1. Find the icon on the desktop that looks like and click it.
  2. When the window opens and the line at the bottom says, "Not connected - press Enter/Space to connect," do it. The image on the screen will look like:

  3. Here, you need to tell ssh what machine you want to connect to---in this case the central unix machine, polylog1.calpoly.edu---and who you are. This shows my login name, pnico, but unless you're me, you should tell it your own central unix login name.
  4. Once you've told it who you are, click Connect and it should connect to the remote machine.

    Note: The first time ssh connects to a particular remote machine, it will display a warning like:

    This is to let you know that ssh will save the identity information that polylog1.calpoly.edu has given it. After this initial connection, every time it connects to polylog1 it compares the offered identity information with the saved information to see if some bad guy is impersonating polylog1. (Think of the wolf from Little Red Riding Hood...).

    Click "Yes" and continue.

  5. That's it. If you got your password right, the next thing you'll see is the remote machine's response. In the case of polylog1, it will first ask what kind of terminal you're using ("vt100"), then it will give you the standard unix command prompt, "%". It should look like:

  6. When finished, log out of the remote machine ("logout" for unix), and disconnect (under the "File" menu").

Transfering files between a local machine and a remote machine

Now that we've covered logging in to a remote machine, we need to talk about transferring files back and forth. In the lab you can keep your files on the Windows server, but if you want to be able to reach them from off campus (or turn them in), you are going to need to be able to transfer them to a publicly visible computer like polylog1.

In the companion program to ssh is sftp which stands for Secure File Transfer Protocol. sftp opens a window that looks like Windows Explorer, except that the files it shows exist on the other machine. To use sftp:

  1. Find the icon on the desktop that looks like and click it.
  2. As above, when the window opens and the line at the bottom says, "Not connected - press Enter/Space to connect," do it. The image on the screen will look like:

  3. Once you have connected, you will see all of the folders (unix calls folders "directories") and files of your directory (see?) on the remote machine displayed in the sftp window:

    This image shows my home directory on polylog1. (You can't see any ordinary files because all of my files are sorted into various folders.) To look in any particular folder, click on it.

    Once you have found the file you are looking for, or the location where you want to put it, you can transfer files from the local machine to the remote machine or vice-versa simply by dragging the file from where it is and dropping it where it's going. The file transfer copies the file so you get a backup in the process.

  4. That's it. When you're done, disconnect and go off to do whatever other things you have to do

Notes on using ssh


9/18/02