How to install FTP Server (pureftp) on CentOS 5.10

Due to backup provider that we use is closing their service I decide to build simple ftp server for this purpose. The problem are I forgot which version of CentOS I use on the server and which ftp server that work well (easy to install).

Solution for 1st problem is using cat.

# cat /etc/redhat-release

CentOS release 5.10 (Final)

Solution for 2nd problem is pureftp.

# yum install pure-ftpd

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.availo.se
* extras: ftp.availo.se
* updates: ftp.availo.se
base                                                                                                                                             | 1.1 kB     00:00
extras                                                                                                                                           | 2.1 kB     00:00
updates                                                                                                                                          | 1.9 kB     00:00
utter-ramblings                                                                                                                                  | 2.3 kB     00:00
Setting up Install Process
No package pure-ftpd available.
Nothing to do

Ups. Looks like CentOS 5 don’t have pureftp built in support. After search for other repo I see epel repo that work.

Check hardware name

# uname -m

x86_64

Use proper version for CentOS 5 64 bit

# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

Retrieving http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
warning: /var/tmp/rpm-xfer.VuxDv0: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing…                ########################################### [100%]
1:epel-release           ########################################### [100%]

Install pureftp

# yum install pure-ftpd

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.availo.se
* epel: mirror.switch.ch
* extras: ftp.availo.se
* updates: ftp.availo.se
epel                                                                                                                                             | 3.7 kB     00:00
epel/primary_db                                                                                                                                  | 3.9 MB     00:00
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package pure-ftpd.x86_64 0:1.0.29-1.el5.1 set to be updated
–> Processing Dependency: libpq.so.4()(64bit) for package: pure-ftpd
–> Running transaction check
—> Package postgresql-libs.x86_64 0:8.1.23-10.el5_10 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package                                     Arch                               Version                                       Repository                           Size
========================================================================================================================================================================
Installing:
pure-ftpd                                   x86_64                             1.0.29-1.el5.1                                epel                                262 k
Installing for dependencies:
postgresql-libs                             x86_64                             8.1.23-10.el5_10                              updates                             197 k

Transaction Summary
========================================================================================================================================================================
Install       2 Package(s)
Upgrade       0 Package(s)

Total download size: 459 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): postgresql-libs-8.1.23-10.el5_10.x86_64.rpm                                                                                               | 197 kB     00:00
(2/2): pure-ftpd-1.0.29-1.el5.1.x86_64.rpm                                                                                                       | 262 kB     00:00
————————————————————————————————————————————————————————
Total                                                                                                                                   850 kB/s | 459 kB     00:00
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 217521f6
epel/gpgkey                                                                                                                                      | 1.7 kB     00:00
Importing GPG key 0x217521F6 “Fedora EPEL <[email protected]>” from /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : postgresql-libs                                                                                                                                  1/2
Installing     : pure-ftpd                                                                                                                                        2/2

Installed:
pure-ftpd.x86_64 0:1.0.29-1.el5.1

Dependency Installed:
postgresql-libs.x86_64 0:8.1.23-10.el5_10

Complete!
#

Check pureftp version

# rpm -qa | grep pure-ftpd

pure-ftpd-1.0.29-1.el5.1

Configure Pureftp

File configuration located in /etc/pure-ftpd/pure-ftpd.conf and well explained. To enable a feature just remove # sign and save the file.

I want simple ftp (each user have access to ftp server and upload their own file).

# nano /etc/pure-ftpd/pure-ftpd.conf

remove # in front of these lines (if exist) :

NoAnonymous                 no

change to

NoAnonymous                 yes

# UnixAuthentication            yes

change to

UnixAuthentication            yes

save the file.

Start pureftp service

# service pure-ftpd start

Starting pure-ftpd:                                        [  OK  ]

alamsyah@alamsyah-Aspire-E1-471:~$ ftp
ftp> open 193.112.123.12
Connected to 193.112.123.12.
220———- Welcome to Pure-FTPd [privsep] [TLS] ———-
220-You are user number 1 of 50 allowed.
220-Local time is now 06:15. Server port: 21.
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Name (193.112.123.12:alamsyah): backup
331 User backup OK. Password required
Password:
230-User backup has group access to:  backup
230 OK. Current restricted directory is /
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir
200 PORT command successful
150 Connecting to port 26403
drwx——    2 backup     backup           4096 Jul  3 06:13 .
drwx——    2 backup     backup           4096 Jul  3 06:13 ..
-rw-r–r–    1 backup     backup             33 Jul  3 06:13 .bash_logout
-rw-r–r–    1 backup     backup            176 Jul  3 06:13 .bash_profile
-rw-r–r–    1 backup     backup            124 Jul  3 06:13 .bashrc
226-Options: -a -l
226 5 matches total
ftp>

Good. FTP server ready to serve 🙂