Linux服务器配置ftp服务

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/Powerful_Fy/article/details/102721955

配置ftp服务:

安装pure-ftpd:

[root@linux ~]# yum -y install epel-release
[root@linux ~]# yum -y install pure-ftpd

修改配置文件:

[root@linux ~]# vi /etc/pure-ftpd/pure-ftpd.conf 

MinUID:
在这里插入图片描述
#该配置表示使用ftp服务的用户UID不能小于1000,UID小于1000的用户无法使用

PureDB密码存储配置:
在这里插入图片描述
#将该行配置的注释去掉,使配置生效(表示ftp服务的虚拟用户和密码存放文件)

创建ftp目录:

[root@linux ~]# mkdir /data/ftp

创建ftp服务用户:

[root@linux ~]# useradd ftpuser

更改ftp目录用户,属组:

[root@linux ~]# chown ftpuser:ftpuser /data/ftp

创建使用ftp的虚拟用户:

[root@linux ~]# pure-pw useradd ftp1 -u ftpuser -d /data/ftp

#创建使用ftp的虚拟用户ftp1,-u 映射到ftp服务用户ftpuser,-p 指定ftp目录

将虚拟用户数据写入到/etc/pure-ftpd/pureftpd.pdb文件中:

[root@linux ~]# pure-pw mkdb

查看ftp虚拟用户命令:

[root@linux ~]# pure-pw list
ftp1                /data/ftp/./ 

启动服务:

[root@linux ~]# systemctl start pure-ftpd.service 

测试ftp:

在ftp目录下添加个测试文件:

[root@linux ~]# cp test.sh /data/ftp/

在另一台机器安装ftp客户端:

[root@centos02 ~]# yum -y install lftp

连接:

[root@centos02 ~]# lftp [email protected]
口令: 
lftp [email protected]:~> ls           
drwxr-xr-x    2 1003       ftpuser            21 Oct 24 14:16 .
drwxr-xr-x    2 1003       ftpuser            21 Oct 24 14:16 ..
-rw-r--r--    1 0          0               14785 Oct 24 14:16 test.sh

#退出exit,测试文件已显示,ftp服务配置完成

在Windows下使用xftp工具连接:

新建会话,填写会话名称、主机地址、ftp用户名和密码:
在这里插入图片描述
连接之后即可显示测试文件:
在这里插入图片描述
补充:

1.如果不配置ftp服务使用xftp连接服务器使用的是sshd服务

2.配置ftp服务后,如果防火墙有限制,需要开启20/21端口

3.sftp使用的是sshd服务的用户,使用的端口是22端口(支持ssh用户密码验证登录,秘钥认证登录等)

4.支持ftp/sftp的工具:xftp、filezilla

5.filezilla官网:https://filezilla-project.org/

猜你喜欢

转载自blog.csdn.net/Powerful_Fy/article/details/102721955