Computer Science @ PENN

java 1.5 api | java 1.4.2 api | slashdot | webmail | wikipedia
upenn.edu | directories | portal | van pelt library
seas.upenn.edu | engineering library
computer graphics & game dev (SIGGRAPH) | dining philosophers (DP) | science & tech wing (STWING) | women in cs (WICS)
CETS Answers |

CSE 1xx : Transferring Files to and from Eniac

Windows

We recommend using the FTP client FileZilla. (You can also login using a program such as SecureCRT to log on remotely to eniac and transfer files via the command line.)

  • Download FileZilla.
  • Launch FileZilla. Go to File -> Site Manager
  • Click the "New Site" button. Type eniac-l.seas.upenn.edu as the host (the letter L for linux, not the number 1). Select SFTP using SSH2 as the servertype (which means "secure file transfer protocol" and "secure shell"). Choose Interactive as the logon type and configure two-step verification. Type your eniac username in the user field. Rename this site something useful like "eniac-l"
  • Now to connect, go to Site Manager, select the site you've just added, and press the "Conect" button. You will be asked to enter your eniac password.
  • You may receive a prompt saying that this host's key isn't cached. Click "Yes" to store the host's key in the registry and avoid receiving this prompt in the future.
  • You can explore the directories of your machine in the left tree and folder views and you can explore the directories on the eniac-l server in the folder view on the right. By default, you will be navigated to your home directory on eniac-l.
  • You can now drag and drop files between your local machine and your folders on the server. Note that dragging and dropping will create copies of the file rather than actually moving the files.

Mac OS X (using a user-friendly program)

Use one of the free, user-friendly SFTP (secure file transfer protocol) applications such as Fugu (or Cyberduck) which have a GUI (graphical user interface).

For Fugu:

  • Download Fugu - this guide uses version 1.2.0 (direct download link).
  • Double-click the .dmg to mount the disk image, if your browser (we recommend Safari) doesn't automatically open safe downloads; then copy the Fugu application to your computer's Applications folder.
  • Open Fugu.app.
  • Optional (setting up a 'favorite' for Eniac): Open Preferences, either by typing apple-comma or by selecting "Preferences..." from the Fugu menu. Click on Favorites (at the top), and then the plus (at the bottom). Where "newhost" is selected, enter anything you want, probably "Eniac". Double-click on "unreal.hostname.local" and type "eniac-l.seas.upenn.edu". Double-click in the user column and enter your Eniac user name. Click outside of the selected text so that the changes are saved, then close the preferences.
  • Back at the Fugu main screen, select "Eniac" (or whatever you called it) from the small world icon at right, if you created a favorite; or, enter "eniac-l.seas.upenn.edu" next to "Connect to:" and your Eniac username next to "Username:". Click connect at the bottom. Enter your password when prompted.
  • Navigate within the two halves of the screen; left is local (your computer), right is remote (meaning Eniac). Dragging files or folders between the halves uploads or downlods as appropriate.
  • When you've finished, click "Disconnect" at the top.
  • Note: Fugu, as of v1.2, has a bug (or missing feature) that means you can't remove directories on the remote side; if you wish to do so, either use command-line sftp or remove the directory in lab.

Mac OS X and Linux (using the command line)

First log on to eniac (directions can be found here). Then use scp (enter username/password for each copy command), sftp (enter username once and issue multiple transfer commands), or rsync.

Note: in the following examples, replace myname with your eniac username.

scp

Using scp is easy. It has sytnax similar to that of the unix cp command (cp from to), along with additional user/host information. After entering an scp command, you will be prompted to enter your password before the command is completed. For detailed info, see the scp man page, available online or by typing "man scp" at a shell prompt. The examples below are a short cheat sheet.

  • Example: Copy a file from your computer to your eniac account
    Copies localfile from the local current directory to the html directory in your eniac account's home directory:

    $ scp localfile myname@eniac-l.seas.upenn.edu:html/

  • Example: Copy a file from your eniac account to your computer
    Copies remotefile from the progs directory in your eniac account to your current directory on your computer. Note that the second argument is a dot "." which means current directory.

    $ scp myname@eniac-l.seas.upenn.edu:progs/remotefile .

  • Example: Copy a file from your computer to a directory on eniac that isn't in your user account:
    Copies localfile to the /usr/local/bin/ directory on eniac — assuming you have the required permissions.

    $ scp localfile myname@eniac-l.seas.upenn.edu:/usr/local/bin/

  • Example: Copy a directory.
    Copies the local 120/homework/ directory (and recursively all it contents) into the remote cse120 directory.

    $ scp -r 120/homework/ myname@eniac-l.seas.upenn.edu:cse120/

  • Example: An efficient way to copy large directories
    Use the tar (tape archive) command to archive the entire directory in to one file. Then compress the archive file using gzip or zip.

    $ tar -cvf myArchive.tar cse1xx/homework
    $ gzip myArchive.tar // if gzip doesn't work, try zip. Still no luck? google and download gzip.
    $ scp -r myArchive.tar.zip myname@eniac-l.seas.upenn.edu:cse1xx/

    NOTE: Depending on your version of tar, "tar -cvfz" may work, which compresses the archive. In this case it would create a file called myArchive.tar.zip.

    To extract the contents of a compressed archive, use $ gunzip myArchive.tar.zip // or unzip
    $ tar -xvf myArchive.tar

sftp

With sftp, you connect to a remote host once and may make multiple transfers between the local and remote computers.
  • To connect, type: sftp username@eniac-l.seas.upenn.edu where "username" is your username. Hit enter, and enter your password when prompted (nothing will appear on your screen as you type — as with most *nix password prompts, SFTP's doesn't echo).
  • At the SFTP prompt, you have many of the usual Unix commands for moving and manipulating files. See the man page for a full listing of commands (or type man sftp). An example session follows.
$ sftp mfickett@eniac-l.seas.upenn.edu Connecting to eniac-l.seas.upenn.edu... The authenticity of host 'eniac-l.seas.upenn.edu (158.130.69.89)' can't be established. RSA key fingerprint is bf:b1:e4:01:4c:d3:69:e2:83:8b:8d:f9:b7:06:a3:a9. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'eniac-l.seas.upenn.edu' (RSA) to the list of known hosts. mfickett@eniac-l.seas.upenn.edu's password:

From the Unix command line, the sftp command opens a connection; here, the username is mfickett (use yours instaed), and the server is eniac-l.seas.upenn.edu, which will be the same for you, connecting to Eniac.

sftp> ls . .. .Favorites .mozilla .muttrc .plan .profile .project .ssh Desktop Filezilla.htm Mail Sites botworld2005Aug26.tar.gz date.sh fluidballs.jar html mail

The ls command lists the contents of the current directory (on the server). As with the normal command, it can be used as ls -l to provide a more detailed listing, including ownership, permissions, and modification times.

sftp> lcd Desktop/ sftp> lls speakerstmp.txt

The lcd and lls commands are like their usual counterparts — cd for changing directory, ls for listing — except that they act on the local side (your computer).

sftp> cd html sftp> ls . .. main.css strstream.h useoldio.h sftp> mget *.h Fetching /mnt/castor/seas_home/m/mfickett/html/strstream.h to strstream.h /mnt/castor/seas_home/m/mfickett/html/strstre 100% 3207 3.1KB/s 00:00 Fetching /mnt/castor/seas_home/m/mfickett/html/useoldio.h to useoldio.h /mnt/castor/seas_home/m/mfickett/html/useoldi 100% 1036 1.0KB/s 00:00

The get command gets a single file, whose name must be specified exactly; the mget gets multiple files, and the filenames can be specified with wildcards; here, * (star or asterisk) matches anything (so .h and anything.h will match. Any files matched on the remote side (the server) are copied to the local side, into the local working directory.

sftp> put speakerstmp.txt Uploading speakerstmp.txt to /mnt/castor/seas_home/m/mfickett/html/speakerstmp.txt speakerstmp.txt 100% 718 0.7KB/s 00:00

The put and mput commands work much like get and mget, except that they copy files from your computer (local) to the server (remote).

sftp> ls . .. main.css speakerstmp.txt strstream.h useoldio.h sftp> rm speakerstmp.txt Removing /mnt/castor/seas_home/m/mfickett/html/speakerstmp.txt

The rm removes a file on the remote side.

sftp> ^D

To close the session, type control-d, or enter exit or bye.

Other useful commands include:

  • mkdir name — make a new directory named name on the remote side
  • rmdir name — remve the directory named name on the remote side
  • !command args — execute the given command on the remote side with the given arguments. For example, !vi file.txt will allow you to edit a file without closing your sftp session or opening a new local shell

other (rsync)

For synchronizing directories (or larger groups of files), you may want to look up rsync. A typical execution I would use is this:

rsync -rlptv --delete ~/Documents/school/upenn/java120/ mfickett@eniac-l.seas.upenn.edu:/home1/m1/mfickett/cse120/

This would make my Eniac cse120/ directory look like the java120/ directory on my computer. The options used are as follows:

  • -r — recursive; copy entire directories
  • -l — preserve links as links
  • -p — preserve permissions
  • -t — preserve modification times
  • -v — verbose; say what's going on
  • --delete — if a file exists locally (my computer) but not remotely (the server; Eniac), delete it from the server
  • -n — not used in this example, the -n flag does a dry run: no files are modified, but all the information is printed out, so you can see if rsync is doing what you want.

As with most command-line usage, be careful; run rsync with the -n and -v flags the first time, especially if you're using --delete. I recommend looking at the rsync examples section.