Linux FTP架设

文章欢迎转载,但转载时请保留本段文字,并置于文章的顶部
作者:Anker Lee
本文原文地址:http://ankerlee.github.io/2015/05/21/Linux-FTP架设


FTP安装和配置

检测和安装vsftpd

[root@localhost var]# vsftpd #检测是否已经安装ftp
-bash: vsftpd: command not found
[root@localhost var]# ll /etc/vsftpd
ls: 无法访问/etc/vsftpd: 没有那个文件或目录
[root@localhost var]# yum install vsftpd #安装ftp

默认配置下启动vsftpd

[root@localhost ~]# /etc/init.d/vsftpd start
为 vsftpd 启动 vsftpd:                                     [确定]
[root@localhost ~]# netstat -tulnp|grep 21
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      1399/vsftpd
[root@localhost ~]#

临时关闭防火墙

[root@localhost ~]# service iptables stop

本机测试ftp连接

[root@localhost ~]# ftp localhost
这时候出现报错信息:-bash: ftp: command not found,原因是未安装ftp客户端,OK,我们来安装ftp客户端,为了下载ftp客户端的安装包,我们先安装下载组件
[root@localhost ~]# yum install wget
接着,我们下载ftp客户端安装包
[root@localhost ~]# wget http://mirror.centos.org/centos/6/os/x86_64/Packages/ftp-0.17-54.el6.x86_64.rpm
最后,安装ftp客户端
[root@localhost ~]# rpm ftp-0.17-54.el6.x86_64.rpm
再次本机测试ftp连接
[root@localhost ~]# ftp localhost
Trying ::1...
ftp: connect to address ::1拒绝连接
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
220 (vsFTPd 2.2.2)
Name (localhost:root): anonymous        #输入匿名账号
331 Please specify the password.
Password:                               #不需要输入密码,直接回车
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> 
OK,本地ftp连接成功!

非本机测试ftp连接

浏览器输入: ftp://192.168.16.112,成功自动以匿名账号登陆,如下图所示:

开启并配置防火墙,以允许ftp访问(待续…)