≡ Menu

FTP servers

Linux / UNIX FTP Commands Tutorial

I switched from MS-Windows to Mac computer running OS X UNIX systems. I need to transfer and download file using ftp for my personal website. Can you provide me a list of FTP commands that may be sent to an FTP server, to upload and download files using UNIX / Linux ftp command line client?
[click to continue…]

Proftpd: Make Sure FTP Client Does Not Timeout

Q. I'm using ProFTPD FTP server under CentOS Linux. How do I make sure that my FTP client does not disconnect or timeout connection to FTP server?
[click to continue…]

PF Firewall Open FTP Port 21 (PASSIVE Configuration)

Question: I've vsftpd ftp server configured under FreeBSD 7.x and PF firewall. Both PF and FTP server running on a dedicated FreeBSD web server. How do I configure PASSIVE FTP PF firewall configuration so that my vsftpd work? How do I configure PF firewall to protect an FTP server and open port 21?
[click to continue…]

CentOS / Red Hat Linux Install VSFTPD FTP Server

Q. How do I configure and install an FTP server in CentOS / RHEL 5 / Fedora Linux server?
[click to continue…]

Dedicated Server Hosting

Q. We have decided to move to Linux and brought a dedicated Dell server preinstalled with Red Hat Linux for hosting our small business website. Can you tell me what software required to run on a Linux dedicated server for hosting purpose?
[click to continue…]

FTP site at osuosl to download Linux ISO / Software

Q. Can you give me FTP site address at osuosl, so that I can download Linux ISO and other software?

A. The Open Source Lab (osuosl) facilitates open source communities and the development and distribution of Open Source Software (OSS). They provide hosting projects and developing software via their web site. The Open Source Lab is a group at Oregon State University dedicated to supporting and developing Open Source software. A wide range of projects are hosted at the lab including Gentoo, Mozilla, Debian, Freenode etc.

osuosl FTP site

Visit ftp site to download Ubuntu, Apache, Slackware, Gentoo, and other OSS software.

Star / Stop FTP server on FreeBSD / OpenBSD

Q. How do I stop / start default FTP server on FreeBSD or OpenBSD UNIX system?

A. ftpd is the Internet File Transfer Protocol server under BSD and configured via inetd. The ftpd utility is the Internet File Transfer Protocol server process. The server uses the TCP protocol and listens at the port specified or by default at port 21.

The inetd server should be run at boot time by /etc/rc. It then listens for connections on certain internet sockets. When a connection is found on one of its sockets, it decides what service the socket corresponds to, and invokes a program to service the request. The server program is invoked with the service socket as its standard input, output and error descriptors. After the program is finished, inetd continues to listen on the socket.

Task: Disable FTPD

Login as root user.

To disable ftpd open /etc/inetd.conf file:
# vi /etc/inetd.conf

Find line:
ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l

To disable a service, comment it out by prefixing the line with '#'.
#ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l

Save and close the file.

Task: Restart inetd

Now just restart inetd, enter:
# /etc/rc.d/inetd restart
OR if you are using OpenBSD:
# kill -HUP `cat /var/run/inetd.pid`

To enable ftp, reverse the step # 1.

VSFTPD limit the number of simultaneous vsftpd connections for a single IP address

Q. How do I force VSFTPD ftp server to limit the number of simultaneous vsftpd connections from the same IP address under Debian Linux?

A. By default VSFTPD allows unlimited connection from the same client IP address. You can easily force vsftpd ftp server to use limited number of connection. There is a special directive called max_per_ip.

Step # 1: Open vsftpd.conf file

Use text editor such as vi to edit /etc/vsftpd.conf or /etc/vsftpd/vsftpd.conf file:
# vi vsftpd.conf

Step # 2: Setup limitation

Set up the max_per_ip=3 (this will limit simultaneous connection to 3 number only)

You are restricting end user to a specific host to 3 concurrent connections.

Step # 3: Restart vsftpd

# /etc/init.d/vsftpd restart

Now vsftpd should limit the number of simultaneous vsftpd connections for a single IP address. If end user try to cross this limit she will see following error message:

421 There are too many connections from IP address.

Ubuntu Linux vsftpd ftp service / server install, configuration howto

Q. How do I install Ubuntu ftp service or server?

A. Ubuntu Linux comes with various ftp servers to setup FTP service such as:
=> proftpd - Versatile, virtual-hosting FTP daemon

=> vsftpd - The Very Secure FTP Daemon

=> ftpd - FTP server

=> wu-ftpd - powerful and widely used FTP server

=> wzdftpd - A portable, modular, small and efficient ftp server

=> pure-ftpd - Pure-FTPd FTP server

I recommend using vsftpd. It is simple and quite secure FTP server. According to vsftpd man page:

vsftpd is the Very Secure File Transfer Protocol Daemon. The server can be launched via a super-server such as inetd or xinetd. Alternatively, vsftpd can be launched in standalone mode, in which case vsftpd itself will listen on the network.

=> Default ftp port : 21
=> Default configuration file : /etc/vsftpd.conf

How do I set up the vsftpd daemon to accept connections from another computer?

The configuration of the vsftpd FTP service (read as daemon ) simply requires three steps.

Step # 1: Install vsftpd

Type apt-get command to install vsftpd
$ sudo apt-get install vsftpd

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 121kB of archives.
After unpacking 438kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com edgy/main vsftpd 2.0.4-0ubuntu5 [121kB]
Fetched 121kB in 0s (246kB/s)
Selecting previously deselected package vsftpd.
(Reading database ... 31396 files and directories currently installed.)
Unpacking vsftpd (from .../vsftpd_2.0.4-0ubuntu5_amd64.deb) ...
Setting up vsftpd (2.0.4-0ubuntu5) ...
Adding system user `ftp' with uid 106...
Adding new user `ftp' (106) with group `nogroup'.
Not creating home directory `/home/ftp'.
 * Starting FTP server: vsftpd

Step # 2: Configure /etc/vsftpd.conf

The default vsftpd configuration file is /etc/vsftpd.conf. You need to edit this file using text editor such as vi:
$ sudo vi /etc/vsftpd.conf

Add the following line (uncomment line) to the vsftpd configuration file:
Above config directive will allow local users to log in via ftp

If you would like to allow users to upload file, add the following to the file:

For security you may restrict local users to their home directories. Add the following to the file:

Save and close the file.

Step # 3: Restart vsftpd

To restart vsftpd type the command :
$ sudo /etc/init.d/vsftpd restart

* Stopping FTP server: vsftpd                                                                                       [ ok ]
 * Starting FTP server: vsftpd                                                                                       [ ok ]

How do I use ftp command line utility?

Now you should be able to FTP to this server with any account that exists on the system except for the root user. From Windows or other Linux system use ftp client, type the command:
$ ftp ftp.nixcraft.in

Connected to ftp.nixcraft.in.
220 (vsFTPd 2.0.4)
Name (ftp.nixcraft.in:vivek): vivek
331 Please specify the password.
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> pwd
257 "/"
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r--    1 1000     1000        91798 Aug 16 08:26 apf-current.tar.gz
-rwxr-xr-x    1 1000     1000          156 Nov 10 07:05 iptables.stop
drwxr-xr-x    3 0        0            4096 Dec 23 11:11 postfix
-rw-r--r--    1 0        0        10481942 Nov 29 23:35 webmin_1.310_all.deb
226 Directory send OK.
ftp> quit
221 Goodbye.

Open FTP port using iptables (optional)

Add following rules to your iptables script. Assuming that default incoming policy is drop. If protocol is TCP and destination port is 21 (ftp):
iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
See - How do I open open ftp port 21 using iptables for more information.

There are a large number of other configuration options available for vsftpd that can be used to fine tune ftp server. Read vsftpd.conf man page by typing following command:
$ man vsftpd.conf

Change vsftpd FTP Server Port Number 21

Because of security issues I would like to change the vsftpd server tcp port # 21. How do I configure vsftpd to use another port instead of the default TCP port 21? How to change vsftpd ftp port number in Linux or Unix?
[click to continue…]