![sftp ftp ftps](https://i-blog.csdnimg.cn/blog_migrate/c5d27127c0e974760ffb4899d6615157.png)
sftp ftp ftps
Lftp is a powerful command line tool which supports FTP, HTTP, SFTP, FISH, TORRENT protocols for file and data transfer. As we can see it supports popular data and file transfer protocols. It uses GNU TLS or OpenSSL for SSL/TLS encryption. In this tutorial we will look installing and different examples with lftp
.
Lftp是功能强大的命令行工具,支持FTP,HTTP,SFTP,FISH,TORRENT协议进行文件和数据传输。 如我们所见,它支持流行的数据和文件传输协议。 它使用GNU TLS或OpenSSL进行SSL / TLS加密。 在本教程中,我们将介绍lftp
安装和其他示例。
安装 (Install)
lftp
is provided Linux distributions from official repositories. We can install it for yum
based distros like Fedora, RedHAT, CentOS with the following command.
lftp
是从官方存储库提供Linux发行版。 我们可以使用以下命令将其安装在基于yum
的发行版中,例如Fedora,RedHAT,CentOS。
$ sudo yum install lftp -y
another alternative is installing it into apt
based distros like Debian, Ubuntu, Kali, Mint.
另一种选择是将其安装到基于apt
的发行版中,例如Debian,Ubuntu,Kali,Mint。
$ sudo yum install lftp -y
语法和帮助 (Syntax and Help)
lftp
provides very simple syntax. We can show syntax and help information with the -h
option like below.
lftp
提供了非常简单的语法。 我们可以使用-h
选项显示语法和帮助信息,如下所示。
$ lftp -h
![Syntax and Help](https://i-blog.csdnimg.cn/blog_migrate/ced7aac0e71db215390160d207e99d04.png)
配置文件(Configuration File)
lftp
tool have very detailed configuration file. This configuration file can be used for specify alias, ssl configuration, proxy configuration, anonymous password, etc. Default path and name of the configuration file is /etc/lftp.conf
. We can print this configuration file like below. In order to edit this file we need root privileges.
lftp
工具有非常详细的配置文件。 该配置文件可用于指定别名,ssl配置,代理配置,匿名密码等。配置文件的默认路径和名称为/etc/lftp.conf
。 我们可以像下面那样打印此配置文件。 为了编辑此文件,我们需要root特权。
$ cat /etc/lftp.conf
![Configuration File](https://i-blog.csdnimg.cn/blog_migrate/ac266abbdc2ad4364e93d095effcffc9.png)
互动壳(Interactive Shell)
lftp
also provides an interactive shell like FTP connections. We just need to issue the lftp
command where we will enter to the interactive shell.
lftp
还提供了交互式外壳,例如FTP连接。 我们只需要发出lftp
命令即可进入交互式shell。
$ lftp
![Interactive Shell](https://i-blog.csdnimg.cn/blog_migrate/3db565f39fcc3f895cc2496968caf942.png)
连接FTP(Connect FTP)
Now we can start the action. We will connect to an FTP server with the lftp
command. We just need to specify the protocol which is FTP in this case and the IP address or host name of the server. In this example we will connect to ftp.metu.edu.tr
.
现在我们可以开始行动了。 我们将使用lftp
命令连接到FTP服务器。 在这种情况下,我们只需要指定FTP协议和服务器的IP地址或主机名即可。 在此示例中,我们将连接到ftp.metu.edu.tr
$ lftp ftp://ftp.metu.edu.tr
![Connect FTP](https://i-blog.csdnimg.cn/blog_migrate/3559457a8fda175470d7ff3de649e928.png)
连接SFTP (Connect SFTP)
Another supported protocol is SFTP. SFTP is very similar with the FTP protocol. But the S
makes the SFTP secure which means the network traffic is encrytpted with SSL/TLS. Other things are the same with FTP. In this example we will connect using sftp://
of IP address 192.168.1.1 .
另一个受支持的协议是SFTP。 SFTP与FTP协议非常相似。 但是S
使SFTP安全,这意味着SSL / TLS加密了网络流量。 其他与FTP相同。 在此示例中,我们将使用IP地址为192.168.1.1的sftp://
进行连接。
$ lftp sftp://192.168.1.1
禁用SSL认证验证 (Disable SSL Certification Verification)
There are a lot of configuration about lftp
. One of the most error prone configuration is SSL and SSL verification. As we know SSL certificates are approved by the authorities. But in some cases servers can use unapproved certificates. This will create following error.
关于lftp
有很多配置。 SSL和SSL验证是最容易出错的配置之一。 我们知道SSL证书是由当局批准的。 但是在某些情况下,服务器可以使用未经批准的证书。 这将产生以下错误。
Fatal error: Certificate verification: Not trusted
In order to prevent this connection error we need to turn of the SSL certificate verify. Following configuration line will disable SSL verification. This configuration line can be put into global configuration file /etc/lftp.conf
or into user local configuration file ~/.lftp/rc
为了防止此连接错误,我们需要打开SSL证书验证。 以下配置行将禁用SSL验证。 该配置行可以放入全局配置文件/etc/lftp.conf
或用户本地配置文件~/.lftp/rc
set ssl:verify-certificate no
代理配置 (Proxy Configuration)
In corporate environment proxy is popular connection technology. In this case we need to specify the proxy configuration to the lftp
. We will set proxy configuration by using bash environment variables. We can set HTTP proxy like below. This line should be put into global configuration file /etc/lftp.conf
or user local configuration file /~/.lftp/rc
.
在公司环境中,代理是流行的连接技术。 在这种情况下,我们需要为lftp
指定代理配置。 我们将使用bash环境变量来设置代理配置。 我们可以像下面这样设置HTTP代理。 该行应放在全局配置文件/etc/lftp.conf
或用户本地配置文件/~/.lftp/rc
。
set http:proxy 192.168.1.1:8080
翻译自: https://www.poftut.com/linux-lftp-client-tutorial-ftp-http-sftp-https-ftps-fish-potocols/
sftp ftp ftps