Choosing a File Transfer Protocol (FTP) Client


FTP uses a client/server model to move files across a network or across the Internet. It allows for the display of remote file directories. With the right permissions, users can open and edit files on remote directories with FTP as well.

By itself, FTP poses a security risk for both client and server, in part because it allows for login information, including usernames and passwords, to be entered (as well as sent across the network) via clear text. So "anonymous" FTP became a standard practice on the Internet. If clients are not given credentials to use to attach to and manipulate stored data on the FTP server, clients can connect to an FTP site with a generic account by using "anonymous" as the username. A custom developed in which the user's email address was used as a password. This would allow you to log on, but with general rights given to that of an anonymous user. Today, in addition to anonymous FTP, SUSE Linux users can be more secure in their file transfers by using the Secure FTP client that comes with OpenSSH, the free version of the Secure Shell. This section will help you use sftp and other FTP clients.

Text-Based FTP Clients

It's good to use a text-based FTP client to learn what is actually going on in a file transfer. Dragging and dropping a file from one place to another is a fine way to simplify what is going on, but to understand the half-dozen commands that are being executed when you drag that file over can help you troubleshoot problems.

YaST installs LukemFTP as the default file transfer client for SUSE Linux. This client was written for the NetBSD version of UNIX, and it works quite well. It replaces the standard FTP client, so you can use all the standard FTP commands.

Common FTP Commands

Following are the most common commands used in a typical FTP session. Be aware that after you have connected with a remote server, most shell navigation commands (cd, ls, and pwd, especially) work nicely.

Starting and Stopping
  • ftp This command starts the FTP client. You cannot connect without typing this first.

  • open This command connects with the remote FTP site, using either the IP address or the domain name. Type ftp at the prompt before using this command.

  • close This closes your connection, but stays in FTP so you can log in to another server.

  • bye This command closes your connection, exits FTP, and returns you to your shell prompt.

  • quit Same as bye. This command closes the connection, exits FTP, and returns you to the shell prompt.

File Types
  • ascii Sets a transfer as ASCII text. Use this when sending or receiving text files only.

  • bin Sets a transfer as binary. Use this when uploading programs, images, or compressed archives. Also make sure that any program, image, or archive you download is marked with this tag. Some Windows clients upload files as ASCII by default; these are useless when downloaded later.

Actions
  • get Initiates a download of a single file from the remote server to your machine. Syntax: get <filename>.

  • put Initiates an upload of a single file from you to the remote machine. Syntax: put <path/filename>.

  • send Same as put.

  • mget Initiates a download of multiple files from the remote machine to your machine. Accepts wildcards as an argument. See also prompt. Example: mget *.png.

  • mput Initiates an upload of multiple files from you to the remote machine. Like mget, it takes wildcards as an argument. See also prompt. Example: mput *.png.

  • prompt This is an interactive command that gives you some control over mgets and mputs with wildcards. Prompt will ask you before you transfer if you want each matching file. This is especially good if you have a slow connection and find yourself downloading a duplicate, or otherwise unwanted, large file. This option is turned on by default.

  • hash Tells FTP to give you a progress bar of hash marks (#) to indicate how the transfer is going.

FTP includes many other useful commands, which can vary from server to server. If you want to check whether a server supports a particular command, run help after you have connected to your site. You'll get a list (but not a description) of available commands.

Tip

For full descriptions of FTP commands, consult the info page for FTP: info ftp. To really dig deep, read the comments in the source code, available on the SUSE Linux DVD.


Using lftp Instead of Plain ftp

The lftp command is not included with a default SUSE Linux installation, but can be installed by YaST. This can be useful if you have a dial-up connection and a transfer stalls or your connection dies in midtransfer. This package supports restarted downloads (as long as the server does, too) and can also support multiple downloads in a single session with job control.

wget 

wget is a useful tool for managing noninteractive transfers, such as mirroring remote directories. It works using standard protocols such as FTP and HTTP, and also secure protocols such as HTTPS. Its noninteractivity might not appear to be a blessing, but this feature enables you to download files in the background or write scripts using wget to back up a directory to a remote location. This utility also supports restarted downloads.

Check out the online documentation at http://www.gnu.org/software/wget/manual.

Using sftp for Secure File Transfers

The Secure FTP client, sftp, was developed as part of the OpenSSH secure shell project to tighten up security problems in some of the fundamental Internet programs. SSH replaced telnet as the remote-connection tool of choice for many users, and sftp does the same for file transfers.

The goal of sftp is not so much to manage the file transfer itself, but to securely transmit login information. This way, files that don't belong in an anonymous FTP directory can still be accessed by those who need them. Instead of connecting with a standard FTP server, sftp connects to the sftp-server component of OpenSSH, allowing for username and password encryption when you log in. sftp does not include all the built-in commands that standard FTP does (you can't use wildcards, for example), but the subset is still quite useful.

If you are concerned that the transfer itself should be secure, you can use the scp (secure copy) command instead of sftp. For this, you'll need to have explicit access to the remote host and also need to know the structure of the file system (that is, where the directory you want to transfer to is located). Secure file transfers are slow because the bits are encrypted, but the lack of speed is well compensated by the peace of mind accompanying the security of the transfer.

Returning to sftp, you can use this only if the remote server has OpenSSH installed. See more on OpenSSH in Chapter 25, "Setting Up Networks and Samba," in the section "Securing Network Services." Secure FTP access is turned on by default in OpenSSH.

Chances are you'll want to use sftp in interactive mode. Enter the IP address or remote hostname with the command to access the remote machine:

sftp <IP address> sftp docs.protek.edu 

By default, the remote machine will recognize you as the current user on your machine. If you have a different username on the remote machine, use the command a little differently:

sftp mmccall@docs.protek.edu 

It will now connect to docs.protek.edu and identify you with the new username.

sshd is usually configured to run on port 22, and this is where sftp tries to connect by default. Some servers can be configured to listen on a different port number, and you can specify that port using the -o switch:

sftp -oPort2221 mmccall@docs.protek.edu 

Now you are connected and see a command prompt on the remote machine. To see exactly what commands are available, type help or a question mark (?) at the prompt. Proceed with your session and quit at the end.

GUI FTP Clients

SUSE Linux includes three standalone graphical FTP clients. Of course, all the web browsers (Konqueror, Epiphany, Mozilla, Galeon, Opera) have FTP clients built in as well. Konqueror in file-management mode (and the Nautilus file manager for GNOME) also has no problem connecting to a remote server and transferring files. Just type the URL for the remote machine into the Location box. In this section, you will learn about gFTP and KBear.

Using gFTP

The gFTP client for GNOME makes it easy to transfer files from any remote host. When you open it up, you'll see your home directory in the left panel (as you can see in Figure 17.1). When you connect to a remote site, its home directory will appear in the right panel.

Figure 17.1. gFTP simplifies file transfer with side-by-side directories and drag-and-drop ease.


The program comes with bookmarks for some of the largest FTP file repositories, including the SUSE FTP servers, so you can browse around for interesting files if you're so inclined. If you already know the site you want to connect to, make the connection by typing the address and the additional information into the Host field. After you have connected, you can go to the Bookmarks menu to add this server to your bookmarks for easy access later.

By default, gFTP is set up for anonymous access and delivers your local email address (<username>@linux.local) as the password. You can change the default address in the Options menu, located under FTP. The program also supports sftp and other SSH protocols. To check the settings for secure transfers, go to the FTP menu, and then select Options, SSH.

Figure 17.1 shows the Emacs directory on the GNU project server at the Massachusetts Institute of Technology. At the bottom of the screen, you can see the text stream noting the commands that have been entered. You cannot directly type commands into this window, but all the standard commands are available from the menus. The right-click context menus work well, too.

As always with Linux systems, the default transfer type is Binary, so if you are uploading or downloading a text file, go to the FTP menu and select Ascii.

Note

Use the ASCII transfer option only if you are moving plain-text files readable with a text editor. Word processing and spreadsheet files are binaries.


To start a transfer, select a file or group of files and drag them from one directory window to the other. You can also use the arrow buttons in the middle of the screen if the download directory is displayed. You must use the cd command to display subdirectories in either window. Select the directory you want to display and use the context menu or the Local or Remote menus (depending on what you're changing) to run the command.

The directory listings are sortable by any of the columns included, so if you want to see the latest additions at the top, click the Date column heading. The columns are also resizable if you can't see everything you want.

When a file is being transferred, it is listed in the transfer window under the directory listings. It will have progress information listed as well. When you have completed your transfers, press Ctrl+Q to issue the bye command and close gFTP.

Using KBear

Many KDE users prefer using Konqueror to manage remote file transfers and local file-management tasks. If you are more comfortable with a traditional FTP two-panel interface or simply have trouble wrapping your mind around the idea that remote files are just another directory structure, KBear can help. Essentially it opens a series of Konqueror windows that appear side-by-side, with a set of FTP-specific menus to help you along.

The first time you run KBear, you are asked to walk through several screens of a configuration wizard. Newbies may be intimidated, but accepting the default settings should work fine. You can always revisit the settings later from the Configure KBear menu under Settings. (The settings menu can also run the wizard for you again.)

KBear's bookmarks feature is called the Sitemanager, and it includes many of the same sites gFTP does, with some additional KDE-specific locations (KDE.org, Qt). The Sitemanager edit screen will import gFTP and other bookmarks (including WS-FTP for Windows) with just a couple of clicks. Figure 17.2 shows this dialog box.

Figure 17.2. Import favorite FTP sites to KBear from another FTP client with this dialog box.


KBear supports multiple connections and transactions, although the interface can get cluttered with the Konqueror toolbar at the top of each window. It also supports sftp and the other SSH protocols. One helpful tool is the two-click Synchronize Current Directories operation. This is good both for remote backup operations and website updates.



SUSE Linux 10 Unleashed
SUSE Linux 10.0 Unleashed
ISBN: 0672327260
EAN: 2147483647
Year: 2003
Pages: 332

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net