Skip Navigation

SFTP, Secure File Transfer Protocol

Summary: SFTP, ( Secure File Transfer Protocol), is an application and method designed to transfer files between different systems, such as Unix, Macintosh or PC computers on the Internet securely. Your username and password will be encrypted. Your EA or other NACS computer account are on machines that are on the Internet. By using one of the SFTP versions available on many NACS computers you can transfer files to and from your account or to a diskette from any remote computer.

1 Using SFTP on Unix Systems

To start SFTP on a UNIX system, simply type sftp followed by a space, and the name of the machine to/from which you wish to transfer files. For example:

sftp ea.nacs.uci.edu

Once you are connected you should see something like this:

220 ea.nacs.uci.edu SFTP server (Version wu-2.4(11) Thu Apr 14 22:37:50 PDT 1994) ready.

Name (sftp.uci.edu:user):

At this prompt, type your login name, if you have an account on this machine, or anonymous if the machine is an anonymous ftp site.

Next you will be prompted for a password. If you are logging in to your own account, type the same password you would use to log in normally. Otherwise, if you logged in as anonymous, type your email address, for example, eaiu239@ea.nacs.uci.edu.

If all went well, you will be logged in to the server and given a sftp> prompt from which you can give ftp commands such as the following.

1.1 Common SFTP Commands

1.1.1 Help

help displays a complete list of sftp commands. You can then type help followed by the command to get a short description of that commands function. Ex: help mget

1.1.2 Get and mget

get is a command that will download one file to the computer you are sitting at. To `get' a file, type get <filename> at the sftp> prompt. For example:

sftp> get readme.txt

will download the file called readme.txt to your local computer.

mget is another version of get that allows you to download multiple files with a single command. For example, if you wanted every file in a directory, you would type:

sftp> mget * (mget xyz* would get all files starting with xyz)

and it would download every file in that directory to the computer you're using.

1.1.3 Put and mput

put does the exact opposite of get; it allows you to put a file of yours on the computer you logged into. To `put' a file, type put <filename> at the sftp> prompt. For example:

sftp> put myfile.txt

would put the file called myfile.txt on the computer you're logged into.

mput works the same as mget, except that it copies local files (on the machine you're sitting at) to the machine you're logged into. For example:

sftp> mput * (mput *xyz would put all files ending with xyz)

would copy every file in the local directory to the `remote' machine (the one you're logged into).

1.1.4 Cd and lcd

cd is a command that allows you to change the directory on the machine you're logged into. For example,

sftp> cd games

would move you into the games directory on the `remote' machine. This allows you to move through the directories, both up and down the file structure. One shortcut: the directory `one level up,' or the `Parent' directory, can be accessed by giving the command

sftp> cd..

lcd is similar to cd, but it changes the directory you are working in on the `local' machine (the one you're sitting at). Otherwise, it works the same as cd.

sftp> lcd mygames

will move you into the mygames directory on the machine at which you are sitting, so that any files you `get' will be put in this directory, and you can `put' files from this directory to the remote host.

1.1.5 ASCII and Binary

These commands control how the transfer takes place. Generally, it is automatically set to ASCII (for text files). However, if you are transfering a binary file, such as a program for DOS or UNIX or an image file, you need to use binary transfer. To do so, simply type:

sftp> binary

You should get a message back like:

200 Type set to I.

That means that the program is set to use binary transfer mode and you're ready to transfer with a put or get. If you need to switch it back, simply type

sftp> ascii

at the prompt. You should get a message back like

200 Type set to A.

1.1.6 Ls

The command ls lists the files on the remote system. Some systems allow you to type dir to get a listing of files along with size and date information.

1.1.7 Prompt

prompt is used in conjunction with mget and mput. If you type prompt just before using mget or mput, all the files will transfer with no interaction from you. Otherwise the system will ask you whether or not you want to transfer each individual file.

1.1.8 Status

status will display a short report on the current status of your settings.

1.1.9 Hash

hash is useful for monitoring the progress of a large file transfer. It will display a hash mark (#) for every 1024 bytes of data transferred.

1.1.10 Quit

quit does just as the name suggests, it closes any connections to `remote' computers, and quits the SFTP program.

[Go to top]