1. 程式人生 > >使用pure-ftpd搭建ftp服務

使用pure-ftpd搭建ftp服務

ftp

1、安裝軟件

[[email protected] ~]# yum install -y epel-release
[[email protected] ~]# yum install -y pure-ftpd

2、更改配置文件

[[email protected] ~]# vim /etc/pure-ftpd/pure-ftpd.conf
PureDB          /etc/pure-ftpd/pureftpd.pdb

3、啟動服務

[[email protected] ~]# systemctl start pure-ftpd
[[email protected] ~]# netstat -lntp | grep 21
tcp        0      0 0.0.0.0:21          0.0.0.0:*        LISTEN      3237/pure-ftpd (SER 
tcp6       0      0 :::21               :::*             LISTEN      3237/pure-ftpd (SER

4、配置用戶和目錄

[[email protected] ~]# mkdir /data/ftp/
[[email protected] ~]# useradd -u 1010 pure-ftp
[[email protected] ~]# chown -R pure-ftp.pure-ftp /data/ftp
[[email protected] ~]# ls -ld /data/ftp
drwxr-xr-x. 2 pure-ftp pure-ftp 4096 Aug 26 13:24 /data/ftp

5、創建一個用戶

[[email protected] ~]# pure-pw useradd ftp_usera -u pure-ftp -d /data/ftp
Password: 
Enter it again

▎pure-pw的用法:

[[email protected] ~]# pure-pw --help

Usage :

pure-pw useradd <login> [-f <passwd file>] -u <uid> [-g <gid>]
                -D/-d <home directory> [-c <gecos>]
                [-t <download bandwidth>] [-T <upload bandwidth>]
                [-n <max number of files>] [-N <max Mbytes>]
                [-q <upload ratio>] [-Q <download ratio>]
                [-r <allow client ip>/<mask>] [-R <deny client ip>/<mask>]
                [-i <allow local ip>/<mask>] [-I <deny local ip>/<mask>]
                [-y <max number of concurrent sessions>]
                [-z <hhmm>-<hhmm>] [-m]

pure-pw usermod <login> -f <passwd file> -u <uid> [-g <gid>]
                -D/-d <home directory> -[c <gecos>]
                [-t <download bandwidth>] [-T <upload bandwidth>]
                [-n <max number of files>] [-N <max Mbytes>]
                [-q <upload ratio>] [-Q <download ratio>]
                [-r <allow client ip>/<mask>] [-R <deny client ip>/<mask>]
                [-i <allow local ip>/<mask>] [-I <deny local ip>/<mask>]
                [-y <max number of concurrent sessions>]
                [-z <hhmm>-<hhmm>] [-m]

pure-pw userdel <login> [-f <passwd file>] [-m]

pure-pw passwd  <login> [-f <passwd file>] [-m]

pure-pw show    <login> [-f <passwd file>]

pure-pw mkdb    [<puredb database file> [-f <passwd file>]]
                [-F <puredb file>]

pure-pw list    [-f <passwd file>]

-d <home directory> : chroot user (recommended)
-D <home directory> : don‘t chroot user
-<option> ‘‘ : set this option to unlimited
-m : also update the /etc/pure-ftpd/pureftpd.pdb database
For a 1:10 ratio, use -q 1 -Q 10
To allow access only between 9 am and 6 pm, use -z 0900-1800

6、轉換密碼文件

[[email protected] ~]# pure-pw mkdb

7、測試效果

[[email protected] ~]# yum install -y lftp
[[email protected] ~]# lftp [email protected]
Password: 
lftp [email protected]:~> ls    
drwxr-xr-x    2 1010       pure-ftp         4096 Aug 26 13:24 .
drwxr-xr-x    2 1010       pure-ftp         4096 Aug 26 13:24 ..

本文出自 “Gorilla City” 博客,請務必保留此出處http://juispan.blog.51cto.com/943137/1959528

使用pure-ftpd搭建ftp服務