Transferring Files with SFTP or SCP |
SFTP and SCP are secure methods of transferring files between computers on a network. They are useful for sharing files with others, using data on more than one system, and downloading files for backup onto a second system. This document is intended to provide you with the basic information you need to use SFTP or SCP when working with your WAM, Glue, or OIT UNIX cluster account.
This document assumes that you are either using your WAM, Glue or OIT UNIX cluster account with SFTP client software or from a terminal window in a computer in a lab, office at the University, or at home.
The SFTP client programs and SCP command described in this document allow you to connect from a local system to a remote system in order to transfer files. The computer system on which you run the client software is referred to as the local system. The system on the other end of your file transfer session (the system running the server software) is referred as the remote system.
In this document, different fonts are used to clarify the meaning of the text:
fixed | indicates a computer response or a system prompt as shown on your display screen. |
bold fixed | indicates words or characters you type. |
italic fixed | is used as general word or phrase for which you must type and substitute text. |
italic | is used as a general word or phrase for which you must substitute text. For example, for other-machine-name you might substitute wam.umd.edu. |
Note: UNIX is case-sensitive. Thus it makes a difference whether commands and file names are typed in upper or lower case.
Secure file transfers to and from local or remote systems can be initiated with the scp UNIX command.
To use the scp command to copy files between systems, use the following command:
scp filename1 userid@hostname:filename2
where filename1 is the file on the local system that you wish to copy, userid@hostname is the userid and hostname where you wish to copy it, and filename2 is the name you want to call the file on the remote system. For example:
scp myfile [email protected]:myfile
Note: SCP may also be used to copy files from a remote system to a local system. To do this in the first example above, reverse the order of filename1 and userid@hostname:filename2.
When this command is typed on the Glue system, it will copy the file to the WAM system.
When you issue the command, you'll be prompted for the password on the remote system. You will then be given the stats of the transfer. Pay attention to the second item on the stat line; it's how much of the file got transferred (you want to see 100%). For example:
scp myfile [email protected]:myfile
[email protected]'s password:
myfile 100% |***************************| 1232 00:00
The password will not show up when typed. The statistics indicate the percentage of the file that was transferred, the size of the file, and the estimated time to transfer the file (in this case, immediate). The scp command gives you three chances to get the password right before it aborts the connection.
To use the scp command to copy directories between systems, use the following command:
scp -r directoryname userid@hostname:directoryname2
where directoryname is the directory on the local system you wish to copy, userid@hostname is the userid and hostname where you wish to copy it, and directoryname2 is the name you want to call the file on the remote system. For example:
scp -r mydirectory [email protected]:mydirectory
Note: SCP may also be used to copy directories from a remote system to a local system. To do this in the first example above, reverse the order of directoryname and userid@hostname:directoryname2.
When this command is typed on the Glue system, it will copy the directory and all of its contents to the WAM system.
The most common way to display help is at a UNIX prompt. Before you issue the scp command you can receive help at the UNIX prompt. An on-line UNIX manual is available for detailed help on scp. To access the manual information about scp, type the following at the UNIX system prompt:
man scp
Secure file transfers to and from a Mac can be initiated with client software such as Fetch 5.0.
For information about downloading Fetch 5.0, see Downloading Fetch 5.0.
To begin using Fetch 5.0 for SFTP:
When you have successfully connected, files on the remote system will appear in the window as shown below.
At this point, you can use the Path button to navigate through directories on the remote system. To begin downloading files from the remote system to your local system, select the file you wish to download and click the Get button. To begin uploading files to the remote system from your local system, click the Put button. Choose the file you wish to upload and click the Put button.
You can receive on-line help from within Fetch by selecting Fetch Help from the Help drop-down menu. The Help menu provides information on installing, using, and troubleshooting the program.
When you have completed your file transfer and you are ready to disconnect from the remote system, close the connection window.
File transfers to and from a Windows PC can be initiated with client software such as F-Secure SSH File Transfer.
For information about downloading and installing F-Secure, see Downloading and Installing F-Secure SSH for Windows.
To begin using F-Secure for SFTP:
Once your connection is established, the F-Secure program displays a window similar to the one above. The window is segmented into two lists. One list displays your local system's files and the other list displays the remote system's files. You can now download as well as upload files between the two systems by clicking once on the name of the file and clicking an arrow to copy the file name to the destination system.
You can receive on-line help from within F-Secure by selecting Help from the pull-down menu. The Help menu provides information on installing, using, and troubleshooting the program. Information is also available on-line at http://www.helpdesk.umd.edu/topics/applications/ftp/f-secure.
When you have completed your file transfer and you are ready to disconnect from the remote system, choose Disconnect from the pull-down File menu. This will disconnect you from the remote system. To quit F-Secure, choose Exit from the pull-down File menu.
For further help in using SCP or SFTP to transfer files, contact the OIT Help Desk. There are two ways you can contact this resource:
Walk-in: | CSS building, room 1400, Monday-Friday, 8:00 a.m. - 5:00 p.m. |
Phone: | 301.405.1500, Monday - Friday, 8:00 a.m. - 5:00 p.m. |