Setup a FTP server - Linux
The File Transfer Protocol (FTP) is a standard network protocol used to transfer computer files between a client and server on a computer network. FTP is built on a client-server model architecture and uses separate control and data connections between the client and the server. FTP users may authenticate themselves with a clear-text sign-in protocol, normally in the form of a username and password, but can connect anonymously if the server is configured to allow it.
VSFTPD
Vsftpd is probably the most secure and fastest FTP server for UNIX-like systems. Vsftpd is a GPL licensed FTP server for UNIX systems, including Linux. It is secure and extremely fast. If your requirements from an FTP server are security, performance and stability, vsftpd is probably the FTP server you are looking for! So Lets get started with the installation:
$ sudo apt-get update
$ sudo apt-get install vsftpd
Now that vsftpd is installed you just need to do a few changes on the vsftpd configuration file with this command: $ sudo nano /etc/vsftpd.conf
1
2
3
4
5
6
7
8
# Uncomment this to enable any form of FTP write command.
write_enable=YES
# Uncomment this to restrict local users to their home directory.
chroot_local_user=YES
# Add this next line to allow local users writes on their home directory.
allow_writeable_chroot=YES
With this changes saved, restart vsftpd server with the folowing command to changes take effect on server: $ sudo service vsftpd restart
.
FileZilla
FileZilla is a free FTP solution. Both a client and a server are available. FileZilla is open source software distributed free of charge under the terms of the GNU General Public License. FileZilla Client is a fast and reliable cross-platform FTP, FTPS and SFTP client with lots of useful features and an intuitive graphical user interface. Just download and install on your system to proceed. Once you open Filezilla Client, just type the host that as vsftpd running, your ftp username and password and press return key to make a connection to vsftpd server. Below is an example:
Most of FTP servers available are configured by default to use passive FTP. If you dont know about active and passive FTP, you must read this web page Active FTP vs. Passive FTP, a Definitive Explanation, all you need to know is explained there. So passive mode on vsftpd is enabled by default, but you can manually configure the interval of ports that server will use. You just need to add a couple lines into vsftpd configuration file.
1
2
3
# Add this lines to manually configure the interval of ports.
pasv_min_port=40000
pasv_max_port=40100
Now just reconnect to vsftpd server with filezilla and check the connections on your machine with netstat.
$ netstat -ant | grep 127.0.0.1
The netstat -ant | grep 127.0.0.1
command output show us the client connected to from port 34374 to port 21 of vsftpd server. This connection is for commands purpose only. For transfer data from server to client and vice-versa there is another connection between port 54531 and 40028. You can see port 40028 is contained in passive mode port interval configured on last step.