HOWTO PureFTPD, MySQL Authenticaton and Usermanager

De Gentoo Linux Wiki

Este articulo es parte de las series de HOWTO.
Kernel & Hardware Red y Servicios Portage Relacionado con el Sistema Servidor X Juegos Misceláneos

Tabla de contenidos

[editar] Requerimientos

  • PureFTPD - el servidor FTP
  • Web server - para servir el USerManager
  • PHP - el userManager esta hecho en PHP
  • MySQL - Para almacenar los usuarios y configuraciones de estos
  • Usermanager - la aplicación para añadir/modificar y borrar usuarios

[editar] Use flags

Necesitas asignar estos USE flags para seguir con esta guía:

  • mysql - Añade soporte mysql para pure-ftpd y PHP
  • posix - Añade soporte posix para PHP
  • session - Añade soporte session para PHP
  • pcre - Añade soporte pcre para PHP

Si te falta alguna de estos USe añádelos al /etc/make.conf y actualiza el php

# emerge -avu php

[editar] Instalar los paquetes

Tener pure-ftpd instalado es fácil, emerge el paquete pure-fptd.

# emerge -av pure-ftpd

The pure-ftpd usermanager is not in Portage, so download and install it manually. Change path to your website document folder:

# cd /var/www/localhost/htdocs

Get the tar ball:

# wget http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz

Untar, this wil create the Usermanager in the folder ftp:

# tar zxf ftp_v2.1.tar.gz

For the created folder, change owner to the proper user/group:

# chown -R apache:apache ftp

Make sure install is named install.php

# cd ftp
# mv install install.php

Make config.php writable

# chmod 664 config.php

[editar] Configure Usermanager

Fireup the install.php in your favorite webbrowser:

http://localhost/ftp/install.php

Follow the installation wizard, you will be guided in 7 steps

  1. Choose New installation, create a new database.
  2. Fill in the hosts/username/password to administrate Mysql, this information is used to create the ftpusers database
  3. Fill in the hosts/username/password for the ftpusers database, this information is used by pure-ftpd to connect to Mysql
  4. Fill in all the stuff, this information is used by the Usermanager in PHP to modify the ftpusers database
    1. When done press the Save button to write the configuration to the config.php file
  5. Fill in a proper password for the Administrator user, this is used to login in the Usermanager
    1. Press the Change button to save the password
  6. Copy all text in the gray block from Step B, paste the text in /etc/pureftpd-mysql.conf and save it
  7. Close the installation wizard

Note Make sure u have a valid password for the ftpusers database user. It must not be empty, or pure-ftpd will fail to start.

[editar] Configure PureFTPD

Like all configuration files on Gentoo, the pure-ftpd configuration file is placed in /etc/conf.d.

Open /etc/conf.d/pure-ftpd

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

Uncomment the configuration flag

IS_CONFIGURED="yes"

Add the mysql authenticator at the end of the file

AUTH="-l mysql:/etc/pureftpd-mysql.conf"

Save and exit nano.

[editar] Start PureFTPD

Start the FTP server

# /etc/init.d/pure-ftpd start

If it fails to start, check the log file

# tail /var/log/messages

If it succeeds, let pure-ftpd start automatically

# rc-update add pure-ftpd default

[editar] Add users

Open the Usermanager, it is an web application so go to

http://localhost/ftp/

Log in with the password as defined in the installation wizard (Step 5). You should now be able to add/delete/modify virtual users.

[editar] Clean up

When all is set and done there are some loose ends we have to take care off. There is a serious security breach when the install.php is public accessible. So delete it or rename it

To delete
# rm /var/www/localhost/htdocs/ftp/install.php
Or rename
# mv /var/www/localhost/htdocs/ftp/install.php /var/www/localhost/htdocs/ftp/install

Delete the downloaded Usermanager tarball

# rm /var/www/localhost/htdocs/ftp_v2.1.tar.gz

[editar] Credits

[editar] Feedback

¿Preocupaciones o elogios? Por favor, usa nuestra sección de discusión.