FTP 命令的使用

2018-07-03 00:59:51来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

最近需要使用 ftp 工具,所以借此机会来进行整理以下具体的内容:

具体什么是ftp, ftp 能干什么?

请参考:

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/s1-ftp

http://cn.linux.vbird.org/linux_server/0410vsftpd.php

重点理解:主动联机 与 被动联机 两种模式中,端口的选择。

 

                                                  主动连接

active mode

       Active mode is the original method used by the FTP protocol for transferring data to the client application. When an active-mode data transfer is initiated by the FTP client, the server opens a connection from port 20 on the server to the IP address and a random, unprivileged port (greater than 1024) specified by the client. This arrangement means that the client machine must be allowed to accept connections over any port above 1024. With the growth of insecure networks, such as the Internet, the use of firewalls for protecting client machines is now prevalent. Because these client-side firewalls often deny incoming connections from active-mode FTP servers, passive mode was devised.

                        

                                                     被动连接

passive mode

       Passive mode, like active mode, is initiated by the FTP client application. When requesting data from the server, the FTP client indicates it wants to access the data in passive mode and the server provides the IP address and a random, unprivileged port (greater than 1024) on the server. The client then connects to that port on the server to download the requested information.
       While passive mode does resolve issues for client-side firewall interference with data connections, it can complicate administration of the server-side firewall. You can reduce the number of open ports on a server by limiting the range of unprivileged ports on the FTP server. This also simplifies the process of configuring firewall rules for the server.
 
安装vsftpd 软件:
?  Desktop yum search vsftpd   
Last metadata expiration check: 5 days, 21:35:37 ago on Tue 26 Jun 2018 04:58:21 PM CST.
================================================== Name Exactly Matched: vsftpd ==================================================
vsftpd.x86_64 : Very Secure Ftp Daemon

vsftpd 全称为:  Very Secure Ftp Daemon

vsftpd 配置文件:我们可以使用 man 5 vsftpd.conf 命令,来查找vsftpd 的配置说明。

FTP 连接与命令:

1. 登录

[root@dhcp-65-15 ~]# ftp localhost
Trying ::1...
Connected to localhost (::1).
220 Welcome to blah FTP service.
Name (localhost:root): yaowen
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
229 Entering Extended Passive Mode (|||60063|)
150 Here comes the directory listing.
drwxr-xr-x    4 1000     1000         4096 Jun 26 08:50 Desktop
drwxr-xr-x    2 1000     1000         4096 Jun 27  2017 Documents
drwxr-xr-x    2 1000     1000         4096 May 29 02:09 Downloads
drwxrwxr-x    3 36       36           4096 Jun 27 02:59 ISO
drwxr-xr-x    4 36       36           4096 Jun 25 08:41 NFS4
drwxr-xr-x    2 1000     1000         4096 Jun 27  2017 Pictures
drwxr-xr-x    2 1000     1000         4096 Jun 27  2017 Public
drwxr-xr-x    2 1000     1000         4096 Jun 27  2017 Templates
drwxr-xr-x    2 1000     1000         4096 Jun 27  2017 Videos
226 Directory send OK.
ftp> 

 2. 如果没有ftp 命令,则进行安装

[root@yaowenxu Desktop]# yum install ftp

3. ftp 支持的命令

使用 help 或者 ? 来进行查看当前服务所支持的命令

ftp> ?
Commands may be abbreviated.  Commands are:

!        debug        mdir        sendport    site
$        dir        mget        put        size
account        disconnect    mkdir        pwd        status
append        exit        mls        quit        struct
ascii        form        mode        quote        system
bell        get        modtime        recv        sunique
binary        glob        mput        reget        tenex
bye        hash        newer        rstatus        tick
case        help        nmap        rhelp        trace
cd        idle        nlist        rename        type
cdup        image        ntrans        reset        user
chmod        lcd        open        restart        umask
close        ls        prompt        rmdir        verbose
cr        macdef        passive        runique        ?
delete        mdelete        proxy        send

我们可以使用 ftp 利用交互式的方式来进行与 ftpd 服务器来进行交互。

我们 可以使用 get 下载文件,使用 put 上传文件;

使用 lcd 确定本地文件夹,使用pwd 确定服务器文件夹。

保持更新,转载请注明出处。

 

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:liunx增强命令

下一篇:Linux 用户 和 组 快速了解