Background:
  • Buying VPS with CentOS 5.3 as its OS and Kloxo as its VPS control panel
  • Need to have Wordpress blog on my website
  • Wordpress -- most of the time -- need ftp account to seamlessly install plugins downloaded from Wordpress.org server
Pure-ftpd on my CentOS VPS simply doesn't work, when I check syslog messages
tail -n 200 /var/log/messages | grep ftp
I got some errors for pure-ftpd:
pure-ftpd: (?@?) [ERROR] Unable to switch capabilities : Operation not permitted
That was problem with lib capabilities (libcap.so). When googling out.. I got several possible resolution on this error :
here, here and here
Which the solution was to alter the OpenVZ or recompile pure-ftpd and not use the one from CentOS build.
Since I didn't own the VM (obviously, I'm just a customer), so, my only choice is to recompile pure-ftpd using the correct parameters. Here are the steps:
  • remove the standard pure-fptd
yum remove pure-ftpd
./configure --with-everything --with-paranoidmsg --without-capabilities --with-virtualchroot

  • And compile it:
make && make install && make clean
Now we have correct pure-ftpd binary on /usr/local/sbin, next task is editing pure-ftpd xinetd config to adapt the new version and location
  • enter /etc/xinetd.d/ directory
  • edit pureftp file, change the content from:
service ftp                                                                    
{                                                                              
        disable = no
                socket_type     = stream                                       
                wait            = no                                           
                user            = root                                         
                server          = /usr/sbin/pure-ftpd                    
                server_args     = -A -c5000 -C8 -D -fftp  -H -I15 -lpuredb:/etc/pure-ftpd/pureftpd.pdb -lunix -L2000:8 -m4 -s -p30000:50000 -U133:022 -u100 -E -Oclf:/var/log/kloxo/pureftpd.log -g/var/run/pure-ftpd.pid -k99 -Z -Y 1
                groups          = yes                                          
                flags           = REUSE                                        
}

into:
service ftp                                                                    
{                                                                              
        disable = no
                socket_type     = stream                                       
                wait            = no                                           
                user            = root                                         
                server          = /usr/local/sbin/pure-ftpd                    
                server_args     = -A -c5000 -C8 -D -fftp  -H -I15 -lpuredb:/etc/pure-ftpd/pureftpd.pdb -lunix -L2000:8 -m4 -s -p30000:50000 -U133:022 -u100 -E -Oclf:/var/log/kloxo/pureftpd.log -g/var/run/pure-ftpd.pid -k99 -Z
                groups          = yes                                          
                flags           = REUSE                                        
}

  • notice that I change server variable and remove "-Y 1" parameters on server_args variable
  • restart xinetd
service xinetd restart

  • test it
[root@vps ~]# ftp localhost
Connected to localhost (127.0.0.1).
220---------- Welcome to Pure-FTPd [privsep] ----------
220-You are user number 1 of 5000 allowed.
220-Local time is now 08:08. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Name (localhost:root):

Congrats, now we have working pure-ftpd server on CentOS 5.3 VPS

2 komentar:

Anonymous said...

This is the best solution ever.. Thank you so much ^^

Victor Moura said...

You could use the lxlabs to solve your problem, i solve my own with it..

Repo:

#additional packages that may be useful
[lxlabsupdate]
name=centos-5-$releasever - lxlabsupdates
baseurl=http://download.lxlabs.com/download/update/centos-5/$basearch/
gpgcheck=0
enabled=1

#packages used/produced in the build but not released
[lxlabslxupdate]
name=centos-5-$releasever - lxlabslxupdates
baseurl=http://download.lxlabs.com/download/update/lxgeneral
gpgcheck=0
enabled=1



As it has packages to openvz compability it is so simple