Transferring Files (FTP/SCP)

Tags FTP SCP

What is FTP?

FTP (File Transfer Protocol) is a protocol used to transfer files between clients and servers on a network. FTP can be used for several functions: exchanging files between accounts and from online software archives, for instance. For the purposes of this article, we will be discussing how to transfer files between a desktop (client) computer and a Linux server.

Prerequisites

You will need to download and install FTP client software, such as FileZilla (available for Windows, Mac, and Linux) or WinSCP (Windows only). You will also need to know the hostname of the server you would like to connect to via FTP, as well as your credentials (username and password) for that server.

Transferring Files

Once you download and open your FTP client on the machine you would like to transfer files to or from, you will be presented with some options. These will be the same regardless of what FTP client you are using:

Host: This is the hostname of the server you'd like to connect to. Example: rt.sdstate.edu
Username: This is the username you use to log in to SDSU's Linux systems - your FacStaff or student account.
Password: The password for this account.
Port: 22

Enter this information in the corresponding fields in your FTP client software and you will be ready to connect.

FTP Client Example: FileZilla

The following is an example of what a connection to a server will look like using the FileZilla FTP client. On the left is the "local site", or the listing of files and folders located on the machine that you are making the connection from. The right side is the "remote site", or the listing of files and folders on the server you are connecting to. To transfer files to the remote site, you can click any files or folders and drag them to the location you'd like them to be copied to on the remote site (and the opposite to transfer files/folders from the remote site to the local site). You can shift+click to select multiple files and folders, or ctrl+click to pick and choose. Though this example is specifically for FileZilla, this process will be very similar for all FTP client software.

A connection made to a remote server with the file transfer program, FileZilla.

Secure Copy Between UNIX Systems

In addition to using an FTP client, on UNIX/Linux or Mac systems, we can also transfer files from system to system by using only the command line. The scp command, secure copy, is similar to the cp command but can be used when either the target or the source is on another system.

As an example, we can copy a file that exists on one of our Linux systems to a remote system using this format:

scp file1 username@server.sdstate.edu:/home

This will copy a file, file1, from the current working directory on the server you are logged in to, to your /home directory to the server that is specified. Note that both cp and scp have a recursive option, -R, that will operate on a folder instead of a file, and will recursively copy the entire directory you specify.

scp -r folder1 username@server.sdstate.edu:/home

The above command will copy the contents of folder1, and all of its subfolders and files, to the /home directory on the server that is specified. The scp command has many more options and switches. For a list of these options and examples, please type man scp at the command line.

 
Was this helpful?
0 reviews
Print Article

Details

Article ID: 135677
Created
Fri 12/3/21 12:44 PM
Modified
Mon 2/27/23 10:59 AM