本章blog 主要讲解[Vsftpd] Centos 6下Vsftpd服务安装教程,Vsftpd用户及.conf配置详解,FTP文件传输协议,并经过案例演示了实体用户登陆vsftpd配置及匿名用户登陆vsftpd配置 。html
FTP 文件传输协议
centos
FTP协议
安全
文件传输协议(英文:File Transfer Protocol,缩写:FTP)是用于在网络上进行文件传输的一套标准协议。它工做于网络传输协议的应用层,使用客户/服务器模式,主要是用来在服务器与客户端之间进行数据传输。FTP 实际上是以 TCP 封包的模式进行服务器与客户端计算机之间的联机,当联机创建后,使用者能够在客户端端连上 FTP 服务器来进行文件的下载与上传,此外,也能够对 FTP 服务器上面的文档进行管理等。bash
FTP服务通道服务器
命令通道ftp:默认端口为 port 21, 用于传输控制流网络
数据通道ftp-data: 默认端口为port 20, 用于在客户端和服务器之间传输数据流session
FTP传输模式并发
FTP支持两种传输模式:Standard (PORT方式,主动方式),Passive (PASV,被动方式)。app
主动模式工做流程:socket
客户端打开一个随机的端口(端口号大于1024,咱们称它为x),启用FTP进程链接至服务器的21号命令端口,创建命令链接通道。
客户端启动随机端口(x+1),同时向服务器21端口发送一个Port命令,此命令告诉服务器客户端正在监听的端口号(x+1)而且已准备好今后端口接收数据。
服务器打开20号源端口而且建立和客户端数据(x+1)端口的链接(主动链接特色),而后FTP服务器将经过端口传送数据。
被动模式工做流程:
客户端打开一个随机的端口(端口号大于1024,咱们称它为x),同时启用FTP进程链接至服务器的21号命令端口,创建命令链接通道。
客户端开始监听端口(x+1),同时向服务器21端口发送一个Pasv命令,等待服务器响应。
服务器收到Pasv命令后,打开一个临时端口(端口号大于1023小于65535,咱们称它为p),而且通知客户端在这个端口上传送数据的请求。
客户端(x+1)端口与FTP服务器(p)端口创建链接(被动链接特色),而后FTP服务器将经过端口传送数据。
综上,主动模式与被动模式的区别: 主动模式是服务器端主动与客户端进行联机 ,而被动模式为客户端主动与服务器端进行联机 。主动模式要求客户端打开而且监听一个端口以建立链接,被动模式只要求客户端和服务器端分别产生一个随机端口以建立链接。
FTP服务器
目前主流的FTP服务器端软件包括:Vsftpd、ProFTPD、PureFTPd、Wuftpd、Server-U FTP、FileZilla Server等软件。
Vsftpd(Very Secure FTP daemon,很是安全的FTP服务进程),是Unix/Linux发行版中最主流的FTP服务器程序,优势小巧轻快,安全易用、稳定高效、知足多用户的使用等。
Vsftpd 服务器设定
1)vsftpd服务器
vsftpd服务器安装,使用yum源安装
[root@VM ~]# yum install vsftpd -y # 安装vsfptd Installed: vsftpd.x86_64 0:2.2.2-24.el6 Complete!
vsftpd服务器相关文件
[root@vm ~]# rpm -ql vsftpd # vsfptd安装生成的文件列表 /etc/pam.d/vsftpd # vsftpd 使用PAM模块时的配置文件,主要作认证功能 /etc/rc.d/init.d/vsftpd # vsftod 服务启动脚本文件 /etc/vsftpd/ftpusers # 用户登陆黑名单,拒绝ftpusers列表内的用户登陆vsftpd,一行一个帐号 /etc/vsftpd/user_list # 这个配置是否可以生效与 vsftpd.conf 内的参数 userlist_enable, userlist_deny 有关 # 默认为用户登陆黑名单,拒绝user_list列表内的用户登陆vsftpd,一行一个帐号 /etc/vsftpd/vsftpd.conf # vsftpd 服务器的主配置文件,配置格式使用 [参数=设定值] 来设定,注意,等号两边不能有空白 /usr/sbin/vsftpd # vsftpd命令执行脚本文件 /var/ftp # 匿名用户访问根目录 /etc/vsftpd/ftpusers # vsftpd 服务器登录用户黑名单,限制用户登录vsftpd,每行一个用户名 /etc/vsftpd/chroot_list # 该目录是不存在的,需要手动创建。主要功能是限制列表中的帐号 chroot 在它们的家目录下。 # 但这个文件生效与 vsftpd.conf 内的 chroot_list_enable, chroot_list_file 两个参数有关
2)centos 中vsftpd默认参数
[root@vm ~]# grep "^[^#]" /etc/vsftpd/vsftpd.conf anonymous_enable=YES # 容许匿名用户访问 local_enable=YES # 容许本地用户访问 write_enable=YES # 容许用户上传数据 local_umask=022 # 本地用户上传文件权限 dirmessage_enable=YES # 定义登陆目录时显示提示信息 xferlog_enable=YES # 使用者上传与下载文件都会被纪录到日志文件中 connect_from_port_20=YES # 表示容许ftp数据通道使用端口20进行数据传输 xferlog_std_format=YES # 设置日志文件是否使用标准的xferlog日志文件格式 listen=YES # 设置vsftpd启动模式为stand alone pam_service_name=vsftpd # 定义pam认证模块为vsftpd userlist_enable=YES # 定义系统用户访问vsftpd黑名单 tcp_wrappers=YES # 支持wrapper防火墙机制
3)vsfptd.conf 配置文件参数及含义
FTP 登陆用户分为3类:
系统用户、匿名用户(anonymous或ftp)、虚拟(guest)用户
在配置相关参数时,注意如下规则:
命令要顶格写,命令以前不能有空格;
参数等号先后没有空格;
匿名用户不是空用户名 ,而是anonymous用户或ftp用户,密码为任意字符 。
chroot功能:用户访问ftp服务器时应该对其chroot,实现禁锢用户与其家目录中 。可经过如下方式实现
方式一:禁锢全部系统用户 chroot_local_user=YES # 开启禁锢功能,全部系统用户都禁锢在其家目录中 chroot_list_enable=NO 方式二:经过/etc/vsftpd/chroot 禁锢部分用户 chroot_local_user=NO chroot_list_enable=YES chroot_list_file=/etc/vsftp/chroot # 不由锢所有用户,将禁锢的用户保存在/etc/vsftp/chroot;每行一个用户 方式三:经过/etc/vsftpd/chroot 确认例外用户,该文件中用户不由锢 chroot_local_user=YES chroot_list_enable=YES chroot_list_file=/etc/vsftp/chroot # 只有写入vsftpd.chroot_list的账户不被chroot,每行一个用户
控制系统用户的登陆机制,可分别经过如下方式实现
方式一:pam.d模块定义的ftpusers用户访问黑名单 /etc/vsftpd/ftpusers 文件中定义了不容许访问ftp服务器的用户 方式二:经过参数定义用户访问黑名单 userlist_enable=YES uselist_deny=YES userlist_file=/etc/vsftpd/user_list # 文件/etc/vsftpd/user_list文件中定义了不容许访问ftp的用户 方式三:经过参数定义用户访问白名单 userlist_enable=YES uselist_deny=NO # 访问ftp服务器的用户白名单 userlist_file=/etc/vsftpd/user_list # 文件/etc/vsftpd/user_list文件中定义了容许访问ftp的用户 注:若同时启用ftpusers的黑名单与user_list 的白名单,ftpusers黑名单优先生效
修改FTP服务器vsftpd的默认根目录
local_root=/media/ftp/pub 修改本地用户默认根路径 anon_root=/var/www/html/ 修改匿名用户默认根路径
配置用户登陆ftp时的欢迎信息login banner,可经过如下方式实现
方式一:若欢迎语内容较少,可经过下面参数直接定义 ftpd_banner=Welcome to access ftp.itwish.cn services.. 方式二:若欢迎语内容较多,可把欢迎语编写为独立的文件,经过参数直接调用文件 banner_file=/etc/vsftpd/banner
与日志参数相关的配置,可经过如下方式实现
方式一: xferlog_enable=YES # 当设定为YES时,使用者上传与下载文件都会被纪录到日志文件中 xferlog_std_format=YES # 设置日志文件是否使用标准的xferlog日志文件格式,YES表示使用标准日志格式 xferlog_file=/var/log/xferlog # 设置日志文件名及路径,需启用xferlog_enable=YES选项 方式二: 建议此项 xferlog_enable=YES # 当设定为YES时,使用者上传与下载文件都会被纪录到日志文件中 xferlog_std_format=NO # 使用标准形式记录传输日志,且默认生成/var/log/vsftpd.log 文件
配置链接客户端限制及传输速率限制
max_clients=0 # vsftpd容许客户端的最大链接数。0,表示不受限制 max_per_ip=0 # 每IP可同时发起并发请求 anon_max_rate=N # 全部匿名用户的最大传输速率为“N字节/秒”,0表明不限制 local_max_rate=N # 全部本地用户的最大传输速率为“N字节/秒”,0表明不限制
与链接超时时间相关的限制
connect_timeout=60 # PORT方式下创建数据链接的超时时间,单位是秒。表示若服务器60s内未能成功链接客户端,则断开链接 accept_timeout=60 # 被动(PASV)数据链接的超时时间,单位是秒。表示若客户端60s内未成功链接服务器,则断开链接 data_connection_timeout=300 # 设置创建FTP数据链接的超时时间,默认为300秒 idle_session_timeout=300 # 设置多长时间不对FTP服务器进行任何操做,则断开该FTP链接,默认为300秒
与用户相关权限的参数配置
local_umask=022 # 本地用户上传文件的umask ,默认为077 anon_umask=077 # 匿名用户上传文件的umask ,默认为077
与guest用户相关权限的参数配置
guest_enable=YES # YES ,表示任何非 anonymous 登入的帐号,均会被当成 guest (访客) guest_username=ftp # 在 guest_enable=YES 时才会生效,指定访客的身份为ftp用户 user_config_dir=/path/to/somewhere # 指定虚拟用户配置目录位置,在这个被指定的目录里,将存放每一个Vsftp用户个性的配置文件,须要注意的是配置文件名必须和用户名相同
与匿名用户相关权限的参数配置
anonymous_enable=YES # 启动匿名用户登陆 write_enable=YES # 容许用户上传数据 anon_upload_enable=YES # 容许虚拟用户有写权限 anon_other_write_enable=YES # 容许虚拟用户有删除权限 anon_mkdir_write_enable=YES # 容许虚拟用户建立文件夹权限 no_anon_password=YES # 当设定为 YES 时,表示 anonymous 将会略过密码检验步骤,而直接登陆 vsftpd 服务器 anon_umask=022 # 配置匿名用户上传文件的umask权限 chown_uploads=YES # 这项是为了安全性,要求匿名用户上传的文件须要管理员确认后,并改变文件权限后才容许下载 chown_username=root # 设置匿名用户上传的文档的属主名。只有chown_uploads=YES时才有效 注意:启用写入功能时,ftp用户对相应的本地文件系统也有相应的写入权限;生效的权限取决于文件系统权限和服务权限的交集
与被动模式相关的参数配置
pasv_enable=YES (NO) # YES,表示启动被动式联机模式(passive mode);NO,表示不启动被动模式 pasv_min_port=0, pasv_max_port=0 # 表示被动模式下最小端口和最大端口范围。 0,表示随机取用而不限制 # 若是您想要使用65400到65410这些端口来进行被动式联机模式的链接,能够这样设定pasv_max_port=65410以及pasv_min_port=65400
上面这些是至关常见的 vsftpd 的设定参数,另还有不少参数没有列出来,您可使用命令# man 5 vsftpd.conf 查阅。
4)vsfptd启动模式
vsftpd 能够拥有两种启动的方式,分别是一直在监听的 stand alone ,一种则是透过 xinetd 来管理的方式,两种方式所使用的启动程序不太相同,而咱们的 CentOS 则预设是以 stand alone 来启动的。 那何时应该选择 stand alone 或者是 super daemon 呢?若是你的 ftp 服务器是提供给大量下载的任务,那建议你使用 stand alone 的方式, 服务的速度上会比较好。若是仅是提供给内部人员使用的 FTP 服务器,使用频率又不是过高的状况下,那建议使用 xinetd来管理便可。
stand alone启动模式,默认Centos 中vsfpd就是该方式启动,无需进行任何配置,利用/etc/init.d/vsftpd 脚本进行启动。
[root@vm ~]# chkconfig vsftpd on # vsftpd加入开机自启动 [root@vm ~]# service vsftpd start # 启动vsftpd服务 [root@vm vsftpd]# ss -tunlp | grep 21 # 21端口是由进程vsfptd所启动的 tcp LISTEN 0 32 *:21 *:* users:(("vsftpd",6355,3))
透过xinetd进行管理的启动模式,经过xinetd 超级进程管理vsftpd
[root@vm ~]# vi /etc/vsftpd/vsftpd.conf # 配置vsftpd功能,修改以下项 listen=NO # YES,表明了stand alone启动模式 ;NO,表明使用xinetd管理vsftpd [root@vm ~]# cp /usr/share/doc/vsftpd-2.2.2/vsftpd.xinetd /etc/xinetd.d/vsftpd # 拷贝vsftpd.xinetd脚本到/etc/xinetd.d/vsftpd ,经过该脚本实现xinetd管理vsftpd应用 [root@vm ~]# vi /etc/xinetd.d/vsftpd # 调整vsftpd 配置文件 # default: off # description: The vsftpd FTP server serves FTP connections. It uses \ # normal, unencrypted usernames and passwords for authentication. service ftp { socket_type = stream wait = no user = root server = /usr/sbin/vsftpd # vsftpd命令路径 server_args = /etc/vsftpd/vsftpd.conf # vsftpd配置文件 nice = 10 disable = no # no表明启用,yes表明禁用 flags = IPv4 } [root@vm ~]# service xinetd restart # 经过重启xinetd服务来启用vsfptd服务 Stopping xinetd: [ OK ] Starting xinetd: [ OK ] [root@vm vsftpd]# ss -tunlp | grep 21 # 21端口是由进程xinetd启动的 tcp LISTEN 0 64 *:21 *:* users:(("xinetd",6283,5))
Vsftpd 服务器案例安装
1)案例:配置仅容许本地用户访问,容许系统用户上传下载、建立、删除权限,限制用户没法离开家目录 (chroot) 、限制下载速率、限制用户上传档案时的权限 (mask)等等,设定/var/ftp/local为本地用户上传、建立、删除、下载目录
设定配置文件
[root@vm vsftpd]# vi /etc/vsftpd/vsftpd.conf # 禁止匿名用户访问 anonymous_enable=NO # 与本地用户相关的参数 local_enable=YES write_enable=YES local_root=/var/ftp/local local_umask=022 # 配置vsftpd服务器端口 connect_from_port_20=YES listen_port=21 # 限制下载速率及客户端链接数 max_clients=5 max_per_ip=2 local_max_rate=2000000 # 配置chroot,实现全部除chroot_list定义的用户外,其余用户均被chroot chroot_local_user=YES chroot_list_enable=YES chroot_list_file=/etc/vsftpd/chroot_list # 配置用户访问vsftpd白名单,即user_list文件中的用户容许访问,其余用户不容许登陆 userlist_enable=YES userlist_deny=NO userlist_file=/etc/vsftpd/user_list # 配置日志 xferlog_enable=YES xferlog_file=/var/log/xferlog xferlog_std_format=YES # 配置提示信息 ftpd_banner=Welcome Access itwish.cn FTP service. dirmessage_enable=YES message_file=.message # 服务器相关其余配置 use_localtime=YES ascii_upload_enable=YES ascii_download_enable=YES listen=NO pam_service_name=vsftpd tcp_wrappers=YES [root@vm ~]# service xinetd restart # 经过重启xinetd服务,实现vsftpd服务的从新启动,重读配置信息 Stopping xinetd: [ OK ] Starting xinetd: [ OK ]
添加用户并配置用户根目录权限
[root@vm local]# groupadd -r fmadmin # 添加系统组fmadmin [root@vm local]# useradd -r -s /sbin/nologin -g fmadmin fmadmin # 添加用户fmadmin,属于fmadmin组,并禁止登录 [root@vm local]# useradd -r -s /sbin/nologin -g fmadmin fmuser [root@vm local]# echo fmadmin | passwd --stdin fmadmin # 配置登陆密码 Changing password for user fmadmin. passwd: all authentication tokens updated successfully. [root@vm local]# echo fmuser | passwd --stdin fmuser Changing password for user fmuser. passwd: all authentication tokens updated successfully. [root@vm ~]# mkdir /var/ftp/local # 建立用户根目录 [root@vm ~]# chmod 775 /var/ftp/local/ # 配置文件夹权限 [root@vm ~]# chown fmuser:fmadmin /var/ftp/local/ # 配置文件夹属性
配置chroot文件
[root@vm local]# touch /etc/vsftpd/chroot_list # 建立chroot_list 文件 [root@vm local]# vi /etc/vsftpd/chroot_list # fmadmin用户不会被chroot ,其余全部用户被chroot fmadmin
配置user_list 用户白名单
[root@vm ~]# vi /etc/vsftpd/user_list # 配置容许登录vsftpd的用户白名单 fmuser fmadmin
配置.message 文件信息
[root@vm local]# vi /var/ftp/local/.message 欢迎访问 itwish FTP 服务器 该目录可容许本地用户上传、下载、删除等权限 感谢使用
测试
[root@vm vsftpd]# ftp localhost # ftp连接本地服务器 Trying ::1... Connected to localhost (::1). 220 Welcome Access itwish.cn FTP service. Name (localhost:root): fmuser # 用户fmuser登陆 331 Please specify the password. Password: 230-欢迎访问 itwish FTP 服务器 # .message 信息 230-该目录可容许本地用户上传、下载、删除等权限 230-感谢使用 230 Login successful. # 连接成功 Remote system type is UNIX. Using binary mode to transfer files. ftp> ls #根目录为/var/ftp/local/ 229 Entering Extended Passive Mode (|||13181|). 150 Here comes the directory listing. drwxrwxr-x 5 513 508 4096 Sep 07 11:21 1 -rw-rw-r-- 1 513 508 0 Sep 07 11:18 2 226 Directory send OK. ftp> dir 229 Entering Extended Passive Mode (|||41022|). 150 Here comes the directory listing. drwxrwxr-x 5 513 508 4096 Sep 07 11:21 1 -rw-rw-r-- 1 513 508 0 Sep 07 11:18 2 226 Directory send OK. ftp> put user_list # 上传文件 local: user_list remote: user_list 229 Entering Extended Passive Mode (|||29288|). 150 Ok to send data. 226 Transfer complete. 306 bytes sent in 3.1e-05 secs (9870.97 Kbytes/sec) ftp> get vsftpd.conf.back # 下载文件 local: vsftpd.conf.back remote: vsftpd.conf.back 229 Entering Extended Passive Mode (|||10890|). 550 Failed to open file. ftp> cd / 250 Directory successfully changed. ftp> pwd # chroot 生效 ,被限定在该目录 257 "/" ftp> ls 229 Entering Extended Passive Mode (|||60884|). 150 Here comes the directory listing. drwxrwxr-x 5 513 508 4096 Sep 07 11:21 1 -rw-rw-r-- 1 513 508 0 Sep 07 11:18 2 -rw-rw-r-- 1 513 508 306 Sep 07 14:24 user_list 226 Directory send OK. ftp> [root@vm vsftpd]# ftp localhost Trying ::1... Connected to localhost (::1). 220 Welcome Access itwish.cn FTP service. Name (localhost:root): fmadmin # 用户fmadmin登陆 331 Please specify the password. Password: 230-欢迎访问 itwish FTP 服务器 # .message 信息 230-该目录可容许本地用户上传、下载、删除等权限 230-感谢使用 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> ls 229 Entering Extended Passive Mode (|||9994|). 150 Here comes the directory listing. drwxrwxr-x 5 513 508 4096 Sep 07 11:21 1 -rw-rw-r-- 1 513 508 0 Sep 07 11:18 2 -rw-rw-r-- 1 513 508 306 Sep 07 14:24 user_list 226 Directory send OK. ftp> cd / # chroot 到根 250 Directory successfully changed. ftp> ls 229 Entering Extended Passive Mode (|||8777|). 150 Here comes the directory listing. dr-xr-xr-x 2 0 0 4096 Jul 18 03:22 bin dr-xr-xr-x 5 0 0 3072 May 30 09:31 boot drwxr-xr-x 4 495 491 4096 Jul 17 14:36 data drwxr-xr-x 18 0 0 3920 Aug 27 10:07 dev ftp> cd /var/ftp/local/ 250 Directory successfully changed. ftp> mkdir b # 建立目录b 257 "/var/ftp/local/b" created ftp> rmdir b # 删除目录b 250 Remove directory operation successful. ftp> delete user_list # 删除文件user_list 250 Delete operation successful. ftp> bye # 退出ftp
2)案例:配置仅容许匿名用户访问,限制匿名用户没法离开家目录 (chroot) 、限制下载速率、限制用户上传档案时的权限 (mask),容许匿名上传、下载权限。设定/var/ftp/pub为匿名用户上传、建立、删除、下载目录
设定配置文件
[root@vm vsftpd]# vi /etc/vsftpd/vsftpd.conf # 容许匿名用户访问、上传、建立、删除权限 anonymous_enable=YES write_enable=YES anon_upload_enable=YES anon_mkdir_write_enable=YES anon_other_write_eanble=YES # 定义匿名登陆不须要输入密码 no_anon_password=YES # 定义匿名登陆上传文件权限为022 anon_umask=022 # 禁止本地用户访问 local_enable=NO # 配置vsftpd服务器端口 connect_from_port_20=YES listen_port=21 # 限制下载速率及客户端链接数 max_clients=20 max_per_ip=5 anon_max_rate=2000000 #为了安全性,限制匿名用户超时时间 data_connection_timeout=300 idle_session_timeout=300 # 配置日志 xferlog_enable=YES xferlog_file=/var/log/xferlog xferlog_std_format=YES # 配置提示信息 ftpd_banner=Welcome Access itwish.cn FTP service. dirmessage_enable=YES message_file=.message # 服务器相关其余配置 use_localtime=YES ascii_upload_enable=YES ascii_download_enable=YES listen=NO pam_service_name=vsftpd tcp_wrappers=YES [root@vm ~]# service xinetd restart # 经过重启xinetd服务,实现vsftpd服务的从新启动,重读配置信息 Stopping xinetd: [ OK ] Starting xinetd: [ OK ]
添加用户并配置用户根目录权限,设定pub为匿名用户上传、建立、删除、下载目录
[root@vm ~]# cd /var/ftp/ [root@vm ftp]# chmod 755 pub/ # 配置文件夹权限, [root@vm ftp]# chown ftp:ftp pub/ # 配置文件夹属性
配置.message 文件信息
[root@vm ~]# vi /var/ftp/.message 欢迎访问 itwish FTP 服务器 该目录仅容许匿名用户访问,容许上传、下载、删除、建立权限 感谢使用
客户端测试
[root@vm ~]# ftp ftp.itwish.cn Connected to ftp.itwish.cn (192.168.23.100). 220 Welcome Access itwish.cn FTP service. Name (ftp.itwish.cn:root): ftp # 用户ftp登陆测试 230-欢迎访问 itwish FTP 服务器 230-该目录仅容许匿名用户访问,容许上传、下载、删除、建立权限 230-感谢使用 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> ls 227 Entering Passive Mode (192,168,23,100,33,102). 150 Here comes the directory listing. drwxrwxr-x 7 508 508 4096 Sep 05 15:53 opensoft drwxr-xr-x 4 14 50 4096 Sep 07 16:37 pub 226 Directory send OK. ftp> dir 227 Entering Passive Mode (192,168,23,100,50,12). 150 Here comes the directory listing. drwxrwxr-x 7 508 508 4096 Sep 05 15:53 opensoft drwxr-xr-x 4 14 50 4096 Sep 07 16:37 pub 226 Directory send OK. ftp> cd pub 250 Directory successfully changed. ftp> pwd 257 "/pub" ftp> put install.log local: install.log remote: install.log 227 Entering Passive Mode (192,168,23,100,175,11). 150 Ok to send data. 226 Transfer complete. 43688 bytes sent in 0.000114 secs (383228.06 Kbytes/sec) ftp> mkdir a 550 Create directory operation failed. ftp> mkdir c 550 Create directory operation failed. ftp> dir 227 Entering Passive Mode (192,168,23,100,152,5). 150 Here comes the directory listing. drwxr-xr-x 4 14 50 4096 Sep 07 16:45 a drwxr-xr-x 2 14 50 4096 Sep 07 16:34 c -rw-r--r-- 1 14 50 43688 Sep 07 16:53 install.log 226 Directory send OK. ftp> get install.log local: install.log remote: install.log 227 Entering Passive Mode (192,168,23,100,42,240). 150 Opening BINARY mode data connection for install.log (43688 bytes). 226 Transfer complete. 43688 bytes received in 0.000307 secs (142306.19 Kbytes/sec) ftp> delete install.log 250 Delete operation successful. ftp> rmdir a 550 Remove directory operation failed. ftp> bye 221 Goodbye. [root@vm ~]# ftp localhost Trying ::1... Connected to localhost (::1). 220 Welcome Access itwish.cn FTP service. Name (localhost:root): anonymous # 用户anonymous登陆测试 230-欢迎访问 itwish FTP 服务器 230-该目录仅容许匿名用户访问,容许上传、下载、删除、建立权限 230-感谢使用 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> ls 229 Entering Extended Passive Mode (|||11030|). 150 Here comes the directory listing. drwxrwxr-x 7 508 508 4096 Sep 05 15:53 opensoft drwxr-xr-x 4 14 50 4096 Sep 07 16:54 pub 226 Directory send OK. ftp> dir 229 Entering Extended Passive Mode (|||14889|). 150 Here comes the directory listing. drwxrwxr-x 7 508 508 4096 Sep 05 15:53 opensoft drwxr-xr-x 4 14 50 4096 Sep 07 16:54 pub 226 Directory send OK. ftp> cd pub 250 Directory successfully changed. ftp> pwd 257 "/pub" ftp> put install.log local: install.log remote: install.log 229 Entering Extended Passive Mode (|||31828|). 150 Ok to send data. 226 Transfer complete. 43688 bytes sent in 0.000103 secs (424155.36 Kbytes/sec) ftp> ls 229 Entering Extended Passive Mode (|||27620|). 150 Here comes the directory listing. drwxr-xr-x 4 14 50 4096 Sep 07 16:45 a drwxr-xr-x 2 14 50 4096 Sep 07 16:34 c -rw-r--r-- 1 14 50 43688 Sep 07 16:58 install.log 226 Directory send OK. ftp> mkdir d 257 "/pub/d" created ftp> dir 229 Entering Extended Passive Mode (|||5779|). 150 Here comes the directory listing. drwxr-xr-x 4 14 50 4096 Sep 07 16:45 a drwxr-xr-x 2 14 50 4096 Sep 07 16:34 c drwxr-xr-x 2 14 50 4096 Sep 07 16:58 d -rw-r--r-- 1 14 50 43688 Sep 07 16:58 install.log 226 Directory send OK.
至此,完成了vsftpd的安装及不一样场景的参数使用。前提需熟悉参数功能,并请根据要求灵活的配置参数。
转载请注明出处:https://blog.51cto.com/itwish