FTP

From LQWiki
Jump to navigation Jump to search

FTP is the File Transfer Protocol and is part of the TCP/IP suite of protocols.

What is FTP?

The File Transfer Protocol is one of the most venerable protocols on the Internet, on par with Telnet. As the name suggests, it is used to transfer files between computers. FTP clients for Linux include ncftp and the original ftp command-line program. Other programs such as Nautilus and gnome-vfs support FTP transactions.

FTP servers listen on TCP port 21. Other ports are used in FTP transactions as well, making it somewhat difficult to easily control via a firewall.

Be aware that ftp passwords are sent unencrypted, and are therefore relatively easy to snoop. If security is an issue use sftp instead.

Perhaps the easiest way to start managing remote ftp resources is through your file manager, because it presents the same interface as you use for local files. An ftp URL takes the form ftp://username:password@server and can be typed into the address field of some file managers.

Files on an ftp server may be used directly by any program if mounted using ftpfs.

FTP Servers

Main article: Ftpd

FTP Clients

Common Problems

Firewalls

The FTP protocol does not interact very well with masquerading firewalls. It is easy to find yourself behind such a firewall without realizing it; if your IP starts with 192.168 or 10. then you certainly are. Commonly, you can log into the remote server fine but cannot download anything.

If you are the administrator for that firewall, you are best served by fixing the firewall. If this is the case, the firewall may be missing one or both of the ip_conntrack_ftp and ip_masq_ftp modules. Try doing a lsmod on the firewall machine and look for these modules. If not, try loading them with modprobe --- e.g. simply modprobe ip_conntrack_ftp ip_masq_ftp will do. If this doesn't work, you will have to check your kernel options.

If you cannot do the above then a local workaround exists, called passive ftp. How this is invoked depends on the program used. E.g. wget can be put into this mode by using wget --passive-ftp.

See also