Department of Computer Science, Johns Hopkins University
spacerHomeAbout UsWhy Join UsPeopleAcademicsResearchEventsServices
Department of Computer Science, Johns Hopkins Universityspacer

Services: Using SCP in the Computer Science Lab

(Assuming you are on the local network or the Internet)

NOTE: In the examples below, we are copying to/from a PC to a unix server, in this case, hops.cs.jhu.edu.

Preparing to use SCP on the NT's

You will need to type the following each time you open the MS-DOS Prompt to run an scp session on the NT's:

set HOME=Z:[username]

Where C:homedir is some directory that you consider home on your machine. It can generally be any directory on the NT to which you can write (your home directory, for example).

When you run scp for the first time on your PC, a .ssh directory (and some accompanying files) will be created in what you set as your HOME directory. This .ssh directory and it's files will be used for subsequent uses of scp. But you must make sure you set the HOME dir after you open the MS-DOS Prompt before you run scp.

Copy (SCP) a file from PC to UNIX server

To copy a file from your PC to your hops (or another host) directory:

1) On your PC, cd to the directory where your file is that you want to transfer.

2) scp filename username@hops.cs.jhu.edu:

Where filename is the file that you want to transfer from your NT, and username is your... username. You can abbreviate the hostname to 'hops' if you are directly on the CS network. Don't forget the trailing " : ".

If, on hops, your PC file is to be copied into a sub-dir of your hops home directory, include that hops home directory's sub-dir(s) in your scp command line. (e.g. Your username is 'user' and your file on your PC is called 'test', and you want to copy (scp) the file into your hops home directory under a series of sub-dirs of called 'testdir/testdir2':)

scp test user@hops.cs.jhu.edu:testdir/testdir2

Notice the use of the forward '/'.

3) You'll be prompted for your hops password.

4) After you put in your password and hit 'Return', the file will be copied to your hops home directory.

Copy (SCP) a file from a UNIX Server to PC

To copy a file from hops (or another host) to your NT machine directory:

1) on your PC, cd to the directory where you want the hops file to go.

2) scp username@hops.cs.jhu.edu:remotefile localfile (where remotefile is the file that you want to transfer from hops, localfile is the name that you want the file to have on the system you're on (DOS), and username is your... username. You can abbreviate the hostname to 'hops' if you are directly on the CS network. Don't forget the trailing ':'.

If, on hops, your file is in a sub-dir of your hops home directory, include that sub-dir(s) in your scp command line.
e.g. Your username is 'user' and your file on hops is called 'test' and resides in your hops home directory under a series of sub-dirs called 'testdir/testdir2'. You want to copy (scp) the file from your testdir2 dir on hops onto the current directory of the PC.:

scp user@hops.cs.jhu.edu:testdir/testdir2/test test

Notice the use of the forward '/'.

3) You'll be prompted for your hops password.

4) After you put in your password and hit 'Return', the file will be copied to your PC.













































spacerSearchContact UsIntegrity CodeAcademics FAQLibrary ResourcesJob Center