Saturday, August 9, 2008

Using FTP Clients in Ubuntu

The FTP protocol allows users to connect to a server, read directories and filenames, and download and upload data. If the correct access rights are set, users can also create new folders and set access permissions on them.

However, using FTP poses a security risk: Usernames and passwords are transmitted unencrypted across a LAN or the Internet. To stop users from taking the risk of giving their authentication details to anyone listening on the wire, many sites only enable anonymous FTP login and file retrieval. Many Linux users have turned to more secure alternatives, such as sshd and sftp or scp, included with the OpenSSH suite.


The FTP Client Interface
Using the text-based FTP interface helps you understand what each action in a graphical FTP session does. This understanding can be handy when, for example, the graphic client does not automatically detect the file type being transferred. In this situation, a binary file is transferred as an ASCII file and is therefore useless. Conversely, an ASCII file transferred as a binary prints the ^M control character at the end of each line. This error typically occurs when transferring files from older Microsoft Windows operating systems to Linux, as the Windows FTP client defaulted to ASCII, not binary transfers.


Using the Text-Based FTP Client Interface
Some of the following common commands may be used in a typical FTP session:

ascii - Sets an ASCII file transfer type for the FTP session. You use this command before file transfers when sending or receiving text files.

bin - Sets a binary file-type transfer for the FTP session. Use it before file transfers to send or receive binary files such as graphics images or compressed archives.

close - Closes a connection to a remote server during an FTP session. Use this command instead of quit to return to the ftp command prompt.

get - Initiates a transfer of a single file from the FTP server to the user's local machine. Use this command to retrieve a single file (such as get cartoon.jpg).

hash - Sets use of a hash mark (#) during file transfer. Use this command to get a visual indication of the progress of a transfer.

mget - Initiates a transfer of multiple files from the FTP server to the user's local machine. Use this command to download (receive) multiple files with a single command (such as mget *.jpg).

mput - Initiates a transfer of multiple files from the user's local machine to the FTP server. Use this command to upload (send) multiple files with a single command (such as mput *.jpg).

open - Opens a connection to a remote server using an IP address or hostname. Use this command when working at the ftp command prompt.

prompt - Is an interactive command that asks the user for input on whether to get a specific file when the mput or mget command is issued. If the user initiates an mget *, with prompting on, the FTP client will prompt the user to transfer each file that the * wildcard matches. This can be particularly useful when several files in a directory need to be transferred, with one or two files that are unwanted. By default, prompting is turned on.

put - Initiates the transfer of a single file from the user's local machine to the FTP server. Use this command to upload (send) a single file (such as put inventory.doc).

quit - Use this command to close the FTP connection and quit the ftp command.


These are just some of the commands available during an FTP session. By typing help, the user can see a full list of valid commands. Typing help command-name displays a brief description of what that command does.


Using Graphical FTP Clients
Many graphical FTP clients are available for Linux. Ubuntu includes the graphical gFTP client (in the gftp-gtk package) and network-aware browsers included with GNOME and KDE. These browsers feature built-in drag-and-drop capability, thus ensuring FTP functionality. Other graphical interface clients that can be used for FTP include the Firefox web browser (the FireFTP extensive is particularly good), KDE's Konqueror, GNOME's Epiphany, and the Nautilus file manager.

Using the gFTP Interface
The GNOME gFTP client provides all the typical features of FTP, including the ability to save profiles of common connections. On the left panel is the local host, and on the right panel is the remote server. A connection is initiated by typing the address of the host into the host field, a specific port if not the standard FTP port (21), a valid username for the server, and a password. After the information has been entered, clicking the icon that looks like a monitor will start the connection to the server. The bottom panel displays session information, such as changing directories.

gFTP sets the file type as binary by default, which can be changed by clicking on ASCII in the FTP drop-down menu. To upload a file to the server, the user clicks on a filename in the left panel and clicks on the right arrow icon. The file is then transferred to the server, and the right panel will be updated to reflect this new file being added to the server. Similarly, to download a file from the server, the user selects the correct file type from the drop-down menu, selects the file to be downloaded, and clicks the left arrow icon. The left panel will then be updated to show the result of the transfer, with logging information shown in the bottom panel.

After all files are uploaded or downloaded, you must close the session. Do this by clicking the red button on the top right of the application window to issue the quit command. gFTP displays the session summary information in the log panel at the bottom of the application. You can also close the session simply by exiting gFTP.


FTP Sessions with Konqueror and Nautilus
Both KDE and GNOME file browsers have integrated FTP functionality built in. Use an ftp:// URL followed by a server name or IP address to start an anonymous FTP session. The drag-and-drop feature of KDE and the GNOME window manager allow users to select remote files and drag them to the desktop.

KDE's Konqueror web browser is capable of handling a number of networking and file transfer protocols, including FTP. You can configure various setting for this browser, such as the appearance of the browser's toolbar, but one of Konqueror's best features is its flexibility for file transfers.

Start the browser by clicking its icon on the KDE's kicker desktop panel or by typing the following at the command line:

$ konqueror &

If your window manager does not support drag and drop, you can use Konqueror's Copy Files feature to retrieve a file. First, type in an FTP URL (such as ftp://ftp.tux.org). Next, navigate to a desired directory and click to select a desired file. You then click the Edit menu's Copy Files menu item (or press F7). A Save dialog will appear and you can select your home directory to save the file. After you press Enter, a file download progress dialog will be displayed while the file is being retrieved.

You can also use the Nautilus browser to retrieve files from a remote server. Connect to a remote FTP server using File > Connect to Server, then simply click to select a file, select Copy from the Edit menu (or press Ctrl+C), click to go to your home directory (using the icon in the Nautilus toolbar), and then click Paste (or press Ctrl+V) to retrieve and save the file.

Source of Information : Ubuntu Unleashed

No comments: