리눅스

본문 바로가기
사이트 내 전체검색


리눅스
리눅스

1. pure-ftpd 설치 및 설정

페이지 정보

작성자 관리자 댓글 0건 조회 6,664회 작성일 20-03-20 19:10

본문

1. pure-ftpd 설치 및 설정

참고.


https://www.howtoforge.com/virtual-hosting-with-pureftpd-and-mysql-incl-quota-and-bandwidth-management-on-centos-5.3



1. 설치


[root@localhost ~]# yum install pure-ftpd
 

[root@localhost ~]# yum install php-mbstring php-mysql

 

2. ftp group 과 user 등록


[root@localhost ~]# groupadd -g 2001 ftpgroup
[root@localhost ~]# useradd -u 2001 -s /bin/false -d /bin/null -c "pureftpd user" -g ftpgroup ftpuser
[root@localhost ~]#
 

3. mysql DataBase 등록


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;

 



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;
 

 

/etc/pure-ftpd/fureftpd-mysql.conf


##############################################

#                                            #

# Sample Pure-FTPd Mysql configuration file. #

# See README.MySQL for explanations.         #

#                                            #

##############################################



# Optional : MySQL server name or IP. Don't define this for unix sockets.


# MYSQLServer     127.0.0.1



# Optional : MySQL port. Don't define this if a local unix socket is used.


# MYSQLPort       3306



# Optional : define the location of mysql.sock if the server runs on this host.


MYSQLSocket     /var/lib/mysql/mysql.sock



# Mandatory : user to bind the server as.


MYSQLUser       pureftpd



# Mandatory : user password. You must have a password.


MYSQLPassword   ftpdpass



# Mandatory : database to open.


MYSQLDatabase   pureftpd



# Mandatory : how passwords are stored

# Valid values are : "cleartext", "argon2", "scrypt", "crypt", "sha1", "md5", "password" and "any"

# ("password" = MySQL password() function, which is sha1(sha1(password)))


MYSQLCrypt      md5,cleartext,password



# In the following directives, parts of the strings are replaced at

# run-time before performing queries :

#

# \L is replaced by the login of the user trying to authenticate.

# \I is replaced by the IP address the user connected to.

# \P is replaced by the port number the user connected to.

# \R is replaced by the IP address the user connected from.

# \D is replaced by the remote IP address, as a long decimal number.

#

# Very complex queries can be performed using these substitution strings,

# especially for virtual hosting.


# Query to execute in order to fetch the password


MYSQLGetPW      SELECT Password FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") 



# Query to execute in order to fetch the system user name or uid

MYSQLGetUID     SELECT Uid FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") 



# Optional : default UID - if set this overrides MYSQLGetUID


#MYSQLDefaultUID 2000



# Query to execute in order to fetch the system user group or gid


MYSQLGetGID     SELECT Gid FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") 



# Optional : default GID - if set this overrides MYSQLGetGID


#MYSQLDefaultGID 1000



# Query to execute in order to fetch the home directory


MYSQLGetDir     SELECT Dir FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") 



# Optional : query to get the maximal number of files 

# Pure-FTPd must have been compiled with virtual quotas support.


MySQLGetQTAFS  SELECT QuotaFiles FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")



# Optional : query to get the maximal disk usage (virtual quotas)

# The number should be in Megabytes.

# Pure-FTPd must have been compiled with virtual quotas support.


MySQLGetQTASZ  SELECT QuotaSize FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")



# Optional : ratios. The server has to be compiled with ratio support.


# MySQLGetRatioUL SELECT ULRatio FROM users WHERE User='\L'

# MySQLGetRatioDL SELECT DLRatio FROM users WHERE User='\L'



# Optional : bandwidth throttling.

# The server has to be compiled with throttling support.

# Values are in KB/s .


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



# Enable ~ expansion. NEVER ENABLE THIS BLINDLY UNLESS :

# 1) You know what you are doing.

# 2) Real and virtual users match.


# MySQLForceTildeExpansion 1



# If you're using a transactionnal storage engine, you can enable SQL

# transactions to avoid races. Leave this commented if you are using the

# traditional MyIsam engine.


# MySQLTransactions On


방화벽 설정

# firewall-cmd --permanent --add-service=ftp
success
# firewall-cmd --reload
success

댓글목록

등록된 댓글이 없습니다.


개인정보취급방침 서비스이용약관 모바일 버전으로 보기 상단으로

TEL. 063-469-4551 FAX. 063-469-4560 전북 군산시 대학로 558
군산대학교 컴퓨터정보공학과

Copyright © www.leelab.co.kr. All rights reserved.