목차
1 Preliminary Note
2 Install MySQL And phpMyAdmin
3 Install PureFTPd With MySQL Support
4 Create The MySQL Database For PureFTPd
5 Configure PureFTPd
데이터 베이스 MySQL 튜토리얼 Virtual Hosting With PureFTPd And MySQL (Incl. Quota And Ban_MySQL

Virtual Hosting With PureFTPd And MySQL (Incl. Quota And Ban_MySQL

Jun 01, 2016 pm 01:16 PM

Virtual Hosting With PureFTPd And MySQL (Incl. Quota And Bandwidth Management) On Ubuntu 14.04LTS

Version 1.0
Author: Falko Timme, updated by Srijan Kishore
Last edited 30/Apr/2014

This document describes how to install a PureFTPd server that uses virtual users from a MySQL database instead of real system users. This is much more performant and allows to have thousands of ftp users on a single machine. In addition to that I will show the use of quota and upload/download bandwidth limits with this setup. Passwords will be stored encrypted as MD5 strings in the database. This tutorial is based on Ubuntu 14.04.

For the administration of the MySQL database you can use web based tools like phpMyAdmin which will also be installed in this howto. phpMyAdmin is a comfortable graphical interface which means you do not have to mess around with the command line.

This howto is meant as a practical guide; it does not cover the theoretical backgrounds. They are treated in a lot of other documents in the web.

This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

1 Preliminary Note

In this tutorial I use the hostnameserver1.example.comwith the IP address192.168.0.100. These settings might differ for you, so you have to replace them where appropriate.

Make sure that you are logged in as root (type in

sudo su

to become root), because we must run all the steps from this tutorial as root user.

2 Install MySQL And phpMyAdmin

This can all be installed with one single command:

apt-get install mysql-server mysql-client phpmyadmin apache2

You will be asked these questions:

New password for the MySQL "root" user:Repeat password for the MySQL "root" user:Web server to reconfigure automatically:Configure database for phpmyadmin with dbconfig-common?

3 Install PureFTPd With MySQL Support

For Ubuntu 14.04 there is a pre-configuredpure-ftpd-mysqlpackage available. Install it like this:

apt-get install pure-ftpd-mysql

Then we create an ftp group (ftpgroup) and user (ftpuser) that all our virtual users will be mapped to. Replace the group- and userid2001with a number that is free on your system:

groupadd -g 2001 ftpgroup
useradd -u 2001 -s /bin/false -d /bin/null -c "pureftpd user" -g ftpgroup ftpuser

4 Create The MySQL Database For PureFTPd

Now we create a database calledpureftpdand a MySQL user namedpureftpdwhich the PureFTPd daemon will use later on to connect to thepureftpddatabase:

mysql -u root -p

CREATE DATABASE pureftpd;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost' IDENTIFIED BY 'ftpdpass';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost.localdomain' IDENTIFIED BY 'ftpdpass';
FLUSH PRIVILEGES;

Replace the stringftpdpasswith whatever password you want to use for the MySQL userpureftpd. Still on the MySQL shell, we create the database table we need (yes, there is only one table!):

USE pureftpd;

CREATE TABLE ftpd (
User varchar(16) NOT NULL default '',
status enum('0','1') NOT NULL default '0',
Password varchar(64) NOT NULL default '',
Uid varchar(11) NOT NULL default '-1',
Gid varchar(11) NOT NULL default '-1',
Dir varchar(128) NOT NULL default '',
ULBandwidth smallint(5) NOT NULL default '0',
DLBandwidth smallint(5) NOT NULL default '0',
comment tinytext NOT NULL,
ipaccess varchar(15) NOT NULL default '*',
QuotaSize smallint(5) NOT NULL default '0',
QuotaFiles int(11) NOT NULL default 0,
PRIMARY KEY (User),
UNIQUE KEY User (User)
) ENGINE=MyISAM;

quit;

As you may have noticed, with thequit;command we have left the MySQL shell and are back on the Linux shell.

BTW, (I'm assuming that the hostname of your ftp server system isserver1.example.com) you can access phpMyAdmin underhttp://server1.example.com/phpmyadmin/(you can also use the IP address instead ofserver1.example.com) in a browser and log in as the userpureftpd. Then you can have a look at the database. Later on you can use phpMyAdmin to administrate your PureFTPd server.

5 Configure PureFTPd

Edit/etc/pure-ftpd/db/mysql.conf. It should look like this:

cp /etc/pure-ftpd/db/mysql.conf /etc/pure-ftpd/db/mysql.conf_orig
cat /dev/null > /etc/pure-ftpd/db/mysql.conf
vi /etc/pure-ftpd/db/mysql.conf

MYSQLSocket/var/run/mysqld/mysqld.sock#MYSQLServer localhost#MYSQLPort 3306MYSQLUser pureftpdMYSQLPassword ftpdpassMYSQLDatabase pureftpd#MYSQLCrypt md5, cleartext, crypt() or password() - md5 is VERY RECOMMENDABLE uppon cleartextMYSQLCryptmd5MYSQLGetPWSELECT Password FROM ftpd WHERE User="/L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "/R")MYSQLGetUID SELECT Uid FROM ftpd WHERE User="/L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "/R")MYSQLGetGID SELECT Gid FROM ftpd WHERE User="/L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "/R")MYSQLGetDir SELECT Dir FROM ftpd WHERE User="/L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "/R")MySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User="/L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "/R")MySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User="/L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "/R")MySQLGetQTASZ SELECT QuotaSize FROM ftpd WHERE User="/L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "/R")MySQLGetQTAFS SELECT QuotaFiles FROM ftpd WHERE User="/L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "/R")
로그인 후 복사

Make sure that you replace the stringftpdpasswith the real password for the MySQL userpureftpdin the lineMYSQLPassword! Please note that we use md5 asMYSQLCryptmethod, which means we will store the users' passwords as an MD5 string in the database which is far more secure than using plain text passwords!

Then create the file/etc/pure-ftpd/conf/ChrootEveryonewhich simply contains the stringyes:

echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone

This will make PureFTPd chroot every virtual user in his home directory so he will not be able to browse directories and files outside his home directory.

Also create the file/etc/pure-ftpd/conf/CreateHomeDirwhich again simply contains the stringyes:

echo "yes" > /etc/pure-ftpd/conf/CreateHomeDir

This will make PureFTPd create a user's home directory when the user logs in and the home directory does not exist yet.

Finally create the file/etc/pure-ftpd/conf/DontResolvewhich again simply contains the stringyes:

echo "yes" > /etc/pure-ftpd/conf/DontResolve

This will make that PureFTPd doesn't look up host names which can significantly speed up connections and reduce bandwidth usage.

Afterwards, we restart PureFTPd:

service pure-ftpd-mysql restart

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
3 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

Alter Table 문을 사용하여 MySQL에서 테이블을 어떻게 변경합니까? Alter Table 문을 사용하여 MySQL에서 테이블을 어떻게 변경합니까? Mar 19, 2025 pm 03:51 PM

이 기사는 MySQL의 Alter Table 문을 사용하여 열 추가/드롭 테이블/열 변경 및 열 데이터 유형 변경을 포함하여 테이블을 수정하는 것에 대해 설명합니다.

MySQL 연결에 대한 SSL/TLS 암호화를 어떻게 구성합니까? MySQL 연결에 대한 SSL/TLS 암호화를 어떻게 구성합니까? Mar 18, 2025 pm 12:01 PM

기사는 인증서 생성 및 확인을 포함하여 MySQL에 대한 SSL/TLS 암호화 구성에 대해 설명합니다. 주요 문제는 자체 서명 인증서의 보안 영향을 사용하는 것입니다. [문자 수 : 159]

MySQL에서 큰 데이터 세트를 어떻게 처리합니까? MySQL에서 큰 데이터 세트를 어떻게 처리합니까? Mar 21, 2025 pm 12:15 PM

기사는 MySQL에서 파티셔닝, 샤딩, 인덱싱 및 쿼리 최적화를 포함하여 대규모 데이터 세트를 처리하기위한 전략에 대해 설명합니다.

인기있는 MySQL GUI 도구는 무엇입니까 (예 : MySQL Workbench, Phpmyadmin)? 인기있는 MySQL GUI 도구는 무엇입니까 (예 : MySQL Workbench, Phpmyadmin)? Mar 21, 2025 pm 06:28 PM

기사는 MySQL Workbench 및 Phpmyadmin과 같은 인기있는 MySQL GUI 도구에 대해 논의하여 초보자 및 고급 사용자를위한 기능과 적합성을 비교합니다. [159 자].

드롭 테이블 문을 사용하여 MySQL에서 테이블을 어떻게 드롭합니까? 드롭 테이블 문을 사용하여 MySQL에서 테이블을 어떻게 드롭합니까? Mar 19, 2025 pm 03:52 PM

이 기사에서는 Drop Table 문을 사용하여 MySQL에서 테이블을 떨어 뜨리는 것에 대해 설명하여 예방 조치와 위험을 강조합니다. 백업 없이는 행동이 돌이킬 수 없으며 복구 방법 및 잠재적 생산 환경 위험을 상세하게합니다.

JSON 열에서 인덱스를 어떻게 생성합니까? JSON 열에서 인덱스를 어떻게 생성합니까? Mar 21, 2025 pm 12:13 PM

이 기사에서는 PostgreSQL, MySQL 및 MongoDB와 같은 다양한 데이터베이스에서 JSON 열에서 인덱스를 작성하여 쿼리 성능을 향상시킵니다. 특정 JSON 경로를 인덱싱하는 구문 및 이점을 설명하고 지원되는 데이터베이스 시스템을 나열합니다.

외국 키를 사용하여 관계를 어떻게 표현합니까? 외국 키를 사용하여 관계를 어떻게 표현합니까? Mar 19, 2025 pm 03:48 PM

기사는 외국 열쇠를 사용하여 데이터베이스의 관계를 나타내고 모범 사례, 데이터 무결성 및 피할 수있는 일반적인 함정에 중점을 둡니다.

일반적인 취약점 (SQL 주입, 무차별 적 공격)에 대해 MySQL을 어떻게 보호합니까? 일반적인 취약점 (SQL 주입, 무차별 적 공격)에 대해 MySQL을 어떻게 보호합니까? Mar 18, 2025 pm 12:00 PM

기사는 준비된 명령문, 입력 검증 및 강력한 암호 정책을 사용하여 SQL 주입 및 무차별 적 공격에 대한 MySQL 보안에 대해 논의합니다 (159 자)

See all articles