最近須要使用 ftp 工具,因此藉此機會來進行整理如下具體的內容:php
具體什麼是ftp, ftp 能幹什麼?html
請參考:linux
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.phpapp
重點理解:主動聯機 與 被動聯機 兩種模式中,端口的選擇。dom
主動鏈接ide
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.
被動鏈接ui
passive modespa
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 肯定服務器文件夾。
保持更新,轉載請註明出處。