使用pure-ftpd搭建ftp服务

使用pure-ftpd搭建ftp服务_第1张图片

1.安装软件包:

[root@weixing01 ~]# yum install -y pure-ftpd
已加载插件:fastestmirror
base                                                                          | 3.6 kB  00:00:00     
epel/x86_64/metalink                                                          | 6.2 kB  00:00:00     
epel                                                                          | 4.7 kB  00:00:00     
extras                                                                        | 3.4 kB  00:00:00     
updates                                                                       | 3.4 kB  00

2.更改配置文件:

[root@weixing01 ~]# vim /etc/pure-ftpd/pure-ftpd.conf 

找到pureftpd.pdb这行,把行首的#删除。

3.关闭vsftpd服务,开启pure-ftpd服务:

[root@weixing01 ~]# systemctl stop vsftpd
[root@weixing01 ~]# systemctl start pure-ftpd.service 
[root@weixing01 ~]# ps aux |grep ftp
root       1578  0.0  0.1 202480  1200 ?        Ss   21:40   0:00 pure-ftpd (SERVER)
root       1581  0.0  0.0 112676   980 pts/0    R+   21:40   0:00 grep --color=auto ftp
[root@weixing01 ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd           
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1012/nginx: master  
tcp        0      0 0.0.0.0:20048           0.0.0.0:*               LISTEN      1003/rpc.mountd     
tcp        0      0 0.0.0.0:47922           0.0.0.0:*               LISTEN      993/rpc.statd       
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      1578/pure-ftpd (SER 
tcp        0      0 0.0.0.0:45781           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      974/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1224/master         
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      1012/nginx: master  
tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd           
tcp6       0      0 :::20048                :::*                    LISTEN      1003/rpc.mountd     
tcp6       0      0 :::21                   :::*                    LISTEN      1578/pure-ftpd (SER 
tcp6       0      0 :::22                   :::*                    LISTEN      974/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1224/master         
tcp6       0      0 :::2049                 :::*                    LISTEN      -                   
tcp6       0      0 :::35363                :::*                    LISTEN      -                   
tcp6       0      0 :::3306                 :::*                    LISTEN      1247/mysqld         
tcp6       0      0 :::38826                :::*                    LISTEN      993/rpc.statd     

4.创建测试目录:并且更改权限

[root@weixing01 ~]# mkdir /data/ftp
[root@weixing01 ~]# useradd -u 1020 pure-ftp
[root@weixing01 ~]# chown -R pure-ftp:pure-ftp /data/ftp

5.添加用户:

[root@weixing01 ~]# pure-pw useradd ftp_usera -u pure-ftp -d /data/ftp
Password: 
Enter it again: 

6.测试

[root@weixing01 ~]# pure-pw mkdb
[root@weixing01 ~]# touch /data/ftp/123.txt
[root@weixing01 ~]# lftp [email protected]
口令: 
lftp [email protected]:~> ls      
drwxr-xr-x    2 1020       pure-ftp           21 Mar 28 21:48 .
drwxr-xr-x    2 1020       pure-ftp           21 Mar 28 21:48 ..
-rw-r--r--    1 0          0                   0 Mar 28 21:48 123.txt
lftp [email protected]:/> quit
[root@weixing01 ~]# chown  pure-ftp:pure-ftp /data/ftp/123.txt 
[root@weixing01 ~]# lftp [email protected]
口令: 
lftp [email protected]:~> ls      
drwxr-xr-x    2 1020       pure-ftp           21 Mar 28 21:48 .
drwxr-xr-x    2 1020       pure-ftp           21 Mar 28 21:48 ..
-rw-r--r--    1 1020       pure-ftp            0 Mar 28 21:48 123.txt