Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up FTP Server by Pureftpd and mysql

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces Pureftpd and mysql how to set up FTP server, the article is very detailed, has a certain reference value, interested friends must read it!

Download mysql5.1.31 rpm files and pure-ftpd source packages

Install the mysql5.1.31 shared package

Rpm-ivh MySQL-shared-community-5.1.31-0.rhel5.i386.rpm

Compile and install pure-ftpd

#. / configure-prefix=/usr/local/pureftpd-with-mysql-with-paranoidmsg-with-welcomemsg-with-uploadscript-with-cookie-with-virtualchroot-with-virtualhosts-with-virtualroot-with-diraliases-with-quotas-with-sysquotas-with-ratios-with-ftpwho-with-throttling # make # make check # make install

Configure pure-ftpd

# cd configuration-file # chmod uplix pure-config.pl # cp pure-config.pl / usr/local/sbin/ # cp pure-ftpd.conf / usr/local/etc/ vi / usr/local/etc/pure-ftpd.conf

Confirm the following three items

ChrootEveryone yes

MySQLConfigFile / etc/pureftpd-mysql.conf

CreateHomeDir yes

Create mysql databases and users for puer-ftpd

CREATE DATABASE pureftpd

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost' IDENTIFIED BY' password'

FLUSH PRIVILEGES

USE pureftpd

CREATE TABLE ftpd (

User varchar (16) NOT NULL default "

Status enum ('01m) 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)

) TYPE=MyISAM

Configure pureftpd-mysql.conf

Vi / etc/pureftpd-mysql.conf

Input

MYSQLSocket / tmp/mysql.sock

# MYSQLServer localhost

# MYSQLPort 3306

MYSQLUser pureftpd

MYSQLPassword password

MYSQLDatabase pureftpd

# MYSQLCrypt md5, cleartext, crypt () or password ()-md5 is VERY RECOMMENDABLE uppon cleartext

MYSQLCrypt md5

MYSQLGetPW SELECT 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")

Notes for each parameter

User: user name

Status: state 1 is active and 0 is inactive.

Password: password

Uid: user system ID number

GID: user group ID number

ULBandwidth: upload * bandwidth unit KB/S

DLBandwidth: download * bandwidth unit KB/S

Comment: comment

Ipaccess: allow access to IP addr

QuotaSize: total disk quota size unit MB

QuotaFiles: the number of files allowed to be stored is unlimited.

Shut down the process

Killall pure-ftpd

Start the service

/ usr/local/sbin/pure-config.pl / usr/local/etc/pure-ftpd.conf

Add users for ftp

USE pureftpd

INSERT INTO `ftpd` (`User`, `status`, `Password`, `Uid`, `Gid`, `Dir`, `ULBandwidth`, `DLBandwidth`, `comment`, `ipaccess`, `QuotaSize`, `QuotaFiles`) VALUES ('test',' 1, MD5 ('test'),' 60031,'/ home/test', '128,' 56, ",'*, '100,' 0')

You can log in to ftp with the user and password in the database

Load pureftpd as a system service

Vi / etc/init.d/pureftpd

Input

#! / bin/bash # chkconfig: 35 95 1 # description: script to start/stop pureftpd

Case $1 in

Start)

/ usr/local/sbin/pure-config.pl / usr/local/etc/pure-ftpd.conf

Stop)

Killall pure-ftpd

*)

Echo "Usage: $0 (start | stop)"

Esac

Change permissions

# chmod 775 pureftpd

Join automatic start

# chkconfig-add pureftpd

View automatic startup settings

# chkconfig-list pureftpd

Pureftpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off

You can start and stop the script later with the following command

# start service pureftpd start

# service pureftpd stop stop

Start and stop the mysql service

# service mysql start

# service mysql stop

If the file cannot be uploaded, set ftp folder permissions

Chmod-R 777 / data0/htdocs

These are all the contents of the article "how Pureftpd and mysql set up FTP servers". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report