Using SFTP

FTP, or File Transfer Protocol, has been moving files from computer to computer since the earliest days of the Internet. To cope with today's more dangerous Internet FTP has added encryption, becoming Secure FTP or SFTP. But the commands remain the same.

There are a wide variety of SFTP clients that will take care of all the actual commands for you, giving you a drag-and-drop interface similar to Windows. For Windows we suggest SecureFX. But SFTP is not difficult to use. In fact, if you're comfortable with Linux you'll find that you only need to learn a few extra commands.

To run SFTP from one of the SSCC Linux servers, type

> sftp server

Where server should be replace by the name of the server you wish to connect to.

The SSCC maintains two FTP servers: ftp.ssc.wisc.edu connects to the Linux file system; ntftp.ssc.wisc.edu connects to the Windows network. In both cases once you log in your remote directory will start out as your home directory.

SSCC FTP Server Addresses
Linux ftp.ssc.wisc.edu
Windows ntftp.ssc.wisc.edu

Note that Linstat does not accept FTP connections. Use ftp.ssc.wisc.edu instead.

FTP Commands

The following basic commands are probably all you'll need to use SFTP.

cd directory

Changes the remote directory to the the directory you enter. Note that Windows servers will generally allow you to use the Linux style slash in path names (directory/subdirectory), but Linux servers will not allow you to use the Windows style backslash (directory\subdirectory).

lcd directory

Changes the local directory to the directory you enter.

ls

Lists the tables of the remote directory

binary

Changes the transfer mode to binary. In these days of proprietary formats for essentially everything, you almost always want to be in binary mode. Many FTP implementations now default to binary mode, but some don't. If you're not in binary mode most files will be garbled in transit, so always check.

get filename

Copies a file from the remote directory to the local directory. Along with put, this is FTP's raison d'etre. Note that if you already have a file with the same name it will be overwritten without warning, so be careful!

put filename

Copies a file from the local directory to the remote directory. The same warning applies.

mget filename

Works like get, except that you can use wildcards (*, etc.) to specify multiple files.

mput filename

Works like put, except that you can use wildcards (*, etc.) to specify multiple files.

help

Lists all the commands available in FTP, but doesn't explain them. Thus it's mostly useful as a reminder.

quit

Quits FTP (exit or logout won't work).

Anonymous FTP

Anonymous FTP allows anyone to use an FTP server, but with many restrictions. It is commonly used for distributing files. When you are asked for a login name just enter anonymous. You will be asked to give your email address as a password, though this is not always enforced.

You can use anonymous FTP to transfer files back and forth between yourself and people who do not have SSCC accounts. However, it is insecure by definition since anyone can use it. Realistically it's unlikely anyone will be prowling our FTP site just to see if anything looks interesting, nevertheless, anonymous FTP should never be used for confidential data.

Making a File Available by Anonymous FTP

The SSCC allows anonymous FTP only to our Linux FTP server (ftp.ssc.wisc.edu). To give someone access to a file by anonymous FTP, log in to Linux, create a directory for yourself under /usr/ftp/pub (for example /usr/ftp/pub/rdimond) and place the file in that directory. The permissions must be set such that others can read the file and both read and execute the directory. The following Linux commands will make a file currently stored in your home directory accessible by anonymous FTP:

> cd /usr/ftp/pub
> mkdir username
> cp ~/filename ./username
> chmod -R o+r username
> chmod o+x username

To get the file, after starting FTP and logging in as anonymous, one would type at the ftp> prompt:

ftp> binary
ftp> cd pub/username
ftp> get filename

Note that literally anyone could get the file in this way; you cannot limit access to anonymous FTP.

Receiving Files by Anonymous FTP

You can also have people outside the SSCC log in as anonymous in order to send you files. Once logged in they need to do the following:

ftp> binary
ftp> cd incoming
ftp> put filename

The file will be stored in /usr/ftp/incoming. Note that all files in the incoming directory are deleted every few days to prevent abuse. You can copy the file to your home directory by typing the following at the Linuxprompt:

> cp /usr/ftp/incoming/filename ~

Of course anyone with an SSCC account could do the same. You cannot delete the original file after you have copied it, but it will be deleted in the course of normal maintenance.

Last Revised: 5/17/2006