LINUX USER GFTP

File Transfer with the Versatile GFTP FTP and Beyond NASA

Whether you like your file transfers with a GUI or from a command prompt, GFTP has the right tool for every job.The GFTP client also supports advanced features such as secure file transfer with SSH. BY MARTIN STEIGERWALD

FTP is a versatile and efficient installed automatically. See the box area shows the current action for a pro- (FTP) labeled “Installing GFTP” for more on tocol. Gclient for systems. GFTP, installing GFTP with Suse or Debian, as Enter the name of the FTP server to which was written by Brian Masney, per- well as details for building GFTP from which you wish to connect in the box forms all the standard chores associated source code. labeled Host at the top of the main win- with downloading and uploading files to dow. You can also enter an FTP FTP servers, and it also offers additional Working with GFTP username and password, and you can services, such as HTTP file transfer, SSH- GFTP launches a classical FTP-style split specify the port number to use for the based file transfer, and simultaneous window, with panels showing the local connection. The split window displays download from multiple servers. The and remote directories (see Figure 1). A the local directory structure on the left GFTP program provides several useful status area below provides information and the remote directories on the right. features that add efficiency to your FTP on the current transfers, and another When you find the file you wish to trans- sessions, such as drag and drop, intelli- gent prompting for existing files, direct Installing GFTP input for FTP commands, and direct If you have Suse Linux,you can run YaST | also means that the menu items created by transfer between two FTP servers. Install and remove software to install the your package management system will GFTP comes in two flavors: the package. SuSE Linux 9.1 has Version point to your customized version. If you gftp- variant supports convenient 2.0.16-44. need to remove your own version,because GUI-based file transfers, whereas gftp- If you prefer to build the software yourself, Suse has introduced a new package,for text is a text-based FTP client used with you will need to install a few tools and devel- example,you can enter su -c “make unin- the shell. If you type gftp, your system oper files before you start. For example,in stall” to do so. may launch either the X11 version or the Suse,make sure you install the YaST C/C++ On Debian Linux,you can enter su -c “apt-get text version, depending on how your Compiler and Tools and Gnome Development install gftp” or opt for a package manager system is configured. selections. such as Synaptic or KPackage to install GFTP; GFTP is available for several popular Download the GFTP source code archive we tested GFTP with Debian Sarge version Linux systems, although it is not always from the project homepage [1],and unpack 2.0.17-5 .The gftp package automatically the package by typing tar -xjf gftp- installs both versions of GFTP,although you What about FTPS? 2.0.17.tar.bz2,or use desktop tools to unpack can install the individual packages,gftp-gtk the tar archive. Change to the gftp-2.0.17 and gftp-text separately if you prefer. FTPS is an SSL-protected variant of FTP.GFTP directory,and follow the usual steps:./con- The packaged version for Debian does not supports the FTPS protocol for encrypting figure ; make ; su -c; make install. provide SSL support at present (see [2]). If the control connection: the program trans- By default,make install places the exe- you intend to use FTPS or HTTPS,compile the mits FTP commands with parameters such cutable GFTP files in /usr/local/bin.This puts software as described previously.But don’t as the password as cipher text but does not your custom-built version higher up the forget to install the libssl-dev package with encrypt files. search path than the regular install,and this the OpenSSL developer files before you do.

76 February 2005 www.linux-magazine.com GFTP LINUX USER

Figure 1:The GFTP main window provides a familiar FTP GUI for uploading Figure 4:The best of both worlds: GFTP lets you use the mouse to navigate and downloading files. the target directory and then type a text-style FTP command. fer, select the file and click the appropri- command into the GFTP main window file from one FTP server to another with- ate arrow button. (The arrow buttons are (see Figure 4). out ever storing the file on the GFTP located between the local and remote If you wish to select multiple files from client computer. GFTP’s direct transfer sides of the main window – see Figure 1. multiple directories to transfer all at option requires that both servers support To transfer a file from the local to the once, you need to disable Start transfer the File Exchange Protocol (FXP), an remote directory, click the arrow point- to stop GFTP from running off and fetch- extension of FTP. To launch a direct ing right. To transfer a file from the ing the files. Then select the files you transfer session, connect to the FTP remote to the local directory, select the need, and re-enable the option to tell the server that will be receiving the files. arrow pointing left.) program to start the file transfer. Then select Local | Open URL… to con- GFTP attempts to resolve file naming GFTP’s support for downloads from nect to the FTP server that will be conflicts before the transfer begins. If a multiple services is excellent. Simply dis- sending the files. file with the same name already exists in connect from the current server and If you attempt to terminate a connec- the target directory, GFTP asks you what connect to another server while the pro- tion while the program is establishing a to do with the file (see Figure 2). The gram carries on with the current connection or reading a directory, GFTP dialog allows you to specify an action for download operation in the background. displays a message in the view area individual files or for all files. The pro- If you select Do transfer one at a time, telling you to click on the Stop button gram supports overwriting and has a the FTP client will process the downloads first. If you do not notice the message, continue mode for interrupted transfers. one after the other. Otherwise, the pro- you might wonder why the program is By default, GFTP suggests continuing a gram simultaneously loads one file each not responding. file transfer. You can select Overwrite by from each server where you have initi- default in FTP | Options | General to ated a download. This only makes sense Configuring File Types change this behavior (see Figure 3). if you have a fast Internet connection. GFTP’s configuration file allows you to The setting in the Options | General GFTP also supports the direct transfer specify which programs to use to display tab labeled Allow command input in GUI of files between two FTP servers. In files of certain types. The program does enables FTP command input (see Figure other words, you can use FTP to move a not have a GUI-based configuration dia- 3). This setting gives users the option of log for this. Open the file .gftp/gftprc in using a GUI without losing the benefit of your home directory with your favorite direct command-line input. If this option editor (see Figure 5). Look for lines that is enabled, you can enter a text-style FTP start with ext= . Each line follows the same pattern, starting with ext=, then a dot and the file extension, the XPM image file to use, the transmission mode, B for binary and A for ASCII, and finally the name, and if needed, the path to the program for dis- playing or playing the file type. Common filetypes like widely spread image and music file formats as well as HTML doc- uments are predefined. Enter your favorite display program for these types. Figure 3:The General tab in the Options dialog It is easy to create a new file type by Figure 2: Resolving file name conflicts in GFTP. box controls the program’s general behavior. copying and modifying an existing line.

www.linux-magazine.com February 2005 77 LINUX USER GFTP

GFTP in the Shell If you intend to use SFTP If you need to transfer files for secure file transfers, you automatically using a script, might like to wait until ver- the shell variant of GFTP is a sion 2.0.18 of GFTP is better option. Typing help released. The current CVS gives you an overview of the snapshot for GFTP already commands supported by the resolves this problem, says GFTP shell version. You can the program’s author. And type help commandname for there are bugfixes for other more detail on a specific com- problems, whereas the cur- mand. rent version of GFTP simply You can type a command has workarounds in the FAQ such as gftp -d ftp://youruser- [3]. For example, you no name:yourpassword@your- longer need to specify the domain.com/directory-with- Figure 5:The configuration file allows you to map applications to file types. path to the SFTP server. SFTP html-files to store the data for should work without any your web hosting account, additional configuration. In a and setting up a cronjob with short test with pre-release this command would give version 2.0.18, an SSH con- you a regular backup. nection worked with the Make sure you set restric- default settings. tive privileges for your shell Secure SFTP-protected file script to protect your FTP transfers are definitely useful password. A script that con- if you are uploading files to tains a password should not your own website. In contrast be accessible to anyone but to an FTP client, an SFTP yourself. If in doubt, leave client encrypts the password out the password. Of course, and the data, however, this if you leave out the password, assumes that your provider you would then need to type has SSH access and SFTP the password every time, support. which would eliminate the benefit of running the script Conclusion with a cronjob. GFTP is an effective tool with a wide range of features. But Other Protocols there is still some room for GFTP also supports file trans- Figure 6:The GFTP FAQ answers questions on problems related to topics such improvement. The Stop but- fer through HTTP and SSH. as SSH connections. tons are not always intuitive. For HTTP, type a URL that And the program would bene- starts with http:// in the Host box in the but to make SSH transfers work, you fit from GUI-based configuration of main window; for SSH, use a URL that need to change a few options below FTP MIME type mappings and display pro- starts with ssh2:// instead. The program | Options | SSH. grams. Support for the Free Desktop only supports version 2 of SSH. The FTP client uses SFTP as the trans- project’s MIME database [4], would also There is no need to modify the default mission protocol. For this to work, the be useful. configurations for FTP and HTTP trans- SFTP server needs to be in an executable missions, unless you use a proxy server, path on the remote server. Enable the INFO Use SSH2 SFTP subsys option for servers [1] GFTP project website: Martin Steigerwald that support this. http://www.gftp.org works as a system We successfully tested both versions administrator at [2] GFTP binaries for Debian without SSL team(ix) GmbH in with an SSH server installation on support:http://bugs.debian.org/cgi-bin/ Nuremberg,Germany, Debian. The first connection attempt bugreport.cgi?bug=251121 http://www.teamix. (using the SSH2 SFTP function) did not [3] GFTP FAQ: de.One focus of his work because Secure Shell prompted us http://www.gftp.org/readme.html work is second level to confirm that we wanted to trust the [4] Shared MIME Database: support for Linux as business desktop for http://www.freedesktop.org/Standards/ customers of team(ix).He already server’s authenticity. GFTP interprets the THE AUTHOR shared-mime-info-spec installed Linux years ago on his Amiga prompt as an error. But the remaining 4000 and uses Linux – preferably connections in this session were fine, as [5] MIME actions:http://www.freedesktop. org/Standards/mime-actions-spec Debian Linux – on his private computers. SSH only prompts you once a session.

78 February 2005 www.linux-magazine.com