TwinFeats SFTP

Stupid File Transfer Program

Kent L. Smotherman
August 1, 1998

Stupid File Transfer Program is NOT traditional FTP, it's not even Trivial FTP, it is 100% custom. So, why in the world did I do it? In my particular ISP environment (cable modem) I have not been able to find any traditional FTP program that will work properly, and TFTP is just toooooo trivial for me. I looked on the net to see if anyone had coded a Java program to meet my needs, and sure enough I found a handful on JARS and GAMELAN. And while I don't want to offend the authors of those apps, they ... shall we say ... left something to be desired. That left me with just one choice: to write my own. And since I am unbelievably, nearly pathetically lazy I was not about to sit down and trudge through the FTP RFC and code it. Instead, I just sat down at the keyboard and hammered out SFTP in a week. Anyway, I wrote SFTP for me so I didn't really care if it followed a standard! And now for the rationalization: SFTP is "more secure" since not just anyone with an FTP client and access my SFTP server, they have to have the SFTP client. Yeah, that's it, it's "more secure" than FTP, you heard it here first...

SFTP supports just about everything you would want in an FTP-like program, from complete user and file security to a nice GUI to work with and fully multithreaded. And since it is a 100% pure Java app it will run on any JDK1.1 platform (It has been tested on Windows NT and Solaris). Now on to the help!
 

Download, Installation & Execution

Everything has been put in a single jar file for convenience, sftp.jar. Or sftp.zip because some versions of Netscape Naviagator and Communicator don't download jar files properly! sftp.zip has a single file, sftp.jar, extract it wherever you like.

You need to put sftp.jar in your CLASSPATH environment variable or you can specify it on the command line (examples assume you are currently located in the directory containing sftp.jar):

For Windows:
jre -classpath %CLASSPATH%;sftp.jar SFTPClientWin

For Unix:
jre -classpath $CLASSPATH:sftp.jar SFTPClientWin

For Mac:
I have no idea! I'll try to find someone with a Mac and Java 1.1 to find out!

To start a SFTP Server just replace SFTPClientWin in the above examples with SFTPServer.
 

SFTP Client

SFTP Client screen shot

Hopefully the SFTP client is fairly intuitive, but we all know how that sort of thing goes so I'll try to explain all the features and functions by a simple walkthrough. The first thing you'll want to do is define your local system. This probably seems kind of strange but you have to remember that Java has no concept of drives, root, or the like, so in SFTP you have to define what you want to see on your local system. You only have to enter this information once, it is all saved in a configuration file and reloaded when you start SFTP Client. Start by clicking Add on the right of the label Local System.This will display a window where you can enter a single drive or root path to access. For example, on windows you might enter c:/ or on unix /user/me. Each entry you add will be verified to exist then added to the list on the right side of the SFTP Client window. Next you'll want to set up a connection to a SFTP server - you do that by clicking Add on the top left of the window. On the resulting window just enter the name you want to associate with the connection, the host name or IP address, port number, your user name and password on that server. The user name and password will be assigned by whoever controls the server. To establish a connection just press Connect and you should see the log at the bottom show the connection and logon process. Once logged on the list on the left of the screen will fill with the top level directories you have been granted access. Now you're ready to start really using SFTP! Any entry with an arrow next to it is a directory. You can expand a directory by clicking on the arrow. If you do this on the server files (left list) then a request to get the directory contents will be issued to the connected server and the display will eventually update when the list arrives. To hide the directory contents just click on the arrow again. If you check the Details box then subsequent directory expands will also show the file's last modification date and size. Note that currently displayed files are not refreshed, you have to hide the directory and reexpand it to fetch and display the details information.

Transferring Files is a simple two step process. On the destination system (either the server file list on the left or the local system on the right) select a destination directory by clicking on a directory name. Keep in mind that SFTP Client supports multiple selection by holding the control key down when you click on files or directories, so be sure to only have one thing selected for your destination or the SFTP Client will not try to transfer. On the source system select as many files or directories as you like, SFTP will transfer them all to the destination system maintaining all necessary directory structures. To start the transfer click either the < (to transfer from the local system to the server) or > (to transfer from the server to the local system) buttons. Of course you must pass the defined access rights for this user on the server on a file by file basis, so you might see some PERMISSION DENIED messages in the log display at the bottom of the window. If you ever suspect that something has gone wrong or want to abort a transfer, the only recourse you have is to click Disconnect. That might seem a bit drastic, but it is quick and effective!

Deleting Files is also quite simple, just select the directories or files you want and click "< DEL" to remove all selected files on the server or "DEL >" to remove all selected files on the local server. You can also right click on a file or directory to see a short popup menu which also contains a Delete option.

Creating Directories is performed through the right click popup menu. Just right click on a directory and select Create Subdirectory from the popup menu and you will be prompted for the new subdirectory name.
 

SFTP Server

SFTP Server screen shot

Ok, I won't even pretend like I did with the SFTP Client that this is intuitive, but with any luck it will still prove to be simple to use and understand! First you'll want to define your server name and port, just fill in the Server and Port text fields located in the top left portion of the window (be sure to hit enter in each field to ensure that the config file gets updated). The server name is whatever you want to call your server, it isn't really used except as info displayed on the client when a logon is first made. Next you'll want to...

Define Users by clicking on Add located at the top right corner of the window. This will set some defaults in the controls which you can modify. Enter the user Name and Password in the respective text fields. Now you're ready to assign the access rights for this user by pressing the Add button to the right of the Access Rights label. This will clear the Path field where you can enter a path or file where you wish to grant access. You can also use Browse... to select a path or file using the FilePicker. The FilePicker has a text field at the bottom where you must enter the starting point you want to display, just like when defining the Local System in the SFTP Client. Enter the path and press enter to get a file diplay where you can then select a file or directory to grant access. Once the Path field is filled in properly just select the desired rights, one of List dirs & files which allows the user to see the file and dir names but not read or write the files, List,Read to grant both list and file read access, or List,Read,Write to grant complete access to the selected file or directory. You can also select Subdirectories too if you want to grant access to the specified directory and all subdirectories it contains recursively. Lastly press Update to transfer the new access rights into the list, then Save to save the current user.

Once you have configured multiple access rights and users, you can edit them. To select a user, just click on the user from the User Database list and the Access Rights, Name, and Password will update with that data. If you change Name or Password be sure to hit Save to update the config file. To modify Access Rights select the path from the Access Rights list and the current settings will be displayed. Change them as desired and press Update to update the config file. When you're all finished with the current user changes press Save. The abbreviation prefixes in the Access Rights list are L (List), LS (List + subdirectories), R (List,Read), RS (List,Read + sibdirectories), W (List,Read,Write), and WS (List,Read,Write + subdirectories). All changes are immediate and there is no reason to restart the server.