Centos服務(wù)器搭建簡單的ftp服務(wù)實踐
Centos服務(wù)器搭建簡單的ftp服務(wù)
實現(xiàn)需求
A公網(wǎng)服務(wù)器:11.11.11.11
- 1、安裝vsftpd服務(wù)
- 2、新增用戶
- 3、添加文件
B私網(wǎng)客戶端:192.168.1.2
- 1、安裝wget、curl、以及l(fā)ftp服務(wù)
- 2、通過三個工具下載文件
實現(xiàn)過程
A:
1、下載vsftpd服務(wù)、并且啟用vsftpd服務(wù)
[root@Leep /]# yum install vsftpd -y -q
Package vsftpd-3.0.2-29.el7_9.x86_64 already installed and latest version
[root@Leep /]# systemctl start vsftpd
[root@Leep /]# systemctl status vsftpd
● vsftpd.service - Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2025-03-14 11:44:25 CST; 16min ago
Process: 24764 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
Main PID: 24765 (vsftpd)
CGroup: /system.slice/vsftpd.service
└─24765 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
Mar 14 11:44:25 Leep systemd[1]: Stopped Vsftpd ftp daemon.
Mar 14 11:44:25 Leep systemd[1]: Starting Vsftpd ftp daemon...
Mar 14 11:44:25 Leep systemd[1]: Started Vsftpd ftp daemon.
[root@Leep /]#
2、創(chuàng)建用戶、并且查看用戶家目錄
[root@Leep /]# useradd -d /var/ftp ftpuser [root@Leep /]# cat /etc/passwd | grep ftp* ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin ftpuser:x:1000:1000::/var/ftp:/bin/bash
3、關(guān)閉系統(tǒng)兩個防火墻
[root@Leep /]# systemctl stop firewalld && setenforce 0 setenforce: SELinux is disabled
4、在指定目錄下創(chuàng)建文件
[root@Leep ftp]# pwd /var/ftp [root@Leep ftp]# ls 1.txt 2.txt pub [root@Leep ftp]# ll total 8 -rw-r--r-- 1 root root 4 Mar 13 15:10 1.txt -rw-r--r-- 1 root root 0 Mar 13 15:53 2.txt drwxr-xr-x 2 root root 4096 Jun 10 2021 pub [root@Leep ftp]#
B:
1、安裝客戶端工具
[root@TestPC /]# yum install lftp wget curl -y
2、使用curl -O 參數(shù)下載FTP網(wǎng)頁內(nèi)容
[root@TestPC /]# curl -O ftp://11.11.11.11/1.txt
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4 100 4 0 0 14 0 --:--:-- --:--:-- --:--:-- 14
您在 /var/spool/mail/root 中有新郵件
[root@TestPC /]# ls 1.txt
1.txt
[root@TestPC /]#
3、使用wget工具下載FTP網(wǎng)頁內(nèi)容
[root@TestPC /]# wget ftp://ftpuser:123@11.11.11.11/2.txt
--2025-03-14 12:11:49-- ftp://ftpuser:*password*@11.11.11.11/2.txt
=> “2.txt.1”
正在連接 11.11.11.11:21... 已連接。
正在以 ftpuser 登錄 ... 登錄成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> 不需要 CWD。
==> SIZE 2.txt ... 完成。
==> PASV ... 完成。 ==> RETR 2.txt ... 完成。
[ <=> ] 0 --.-K/s 用時 0s
2025-03-14 12:11:49 (0.00 B/s) - “2.txt.1” 已保存 [0]
4、使用lftp工具下載FTP網(wǎng)頁內(nèi)容
[root@TestPC ftp]# lftp -u ftp 11.11.11.11 口令: lftp ftp@11.11.11.11:~> dir -rw-r--r-- 1 0 0 4 Mar 13 07:10 1.txt -rw-r--r-- 1 0 0 0 Mar 13 07:53 2.txt drwxr-xr-x 2 0 0 4096 Jun 09 2021 pub lftp ftp@11.11.11.11:/> get 1.txt 4 bytes transferred in 2 seconds (2b/s)y] lftp ftp@11.11.11.11:/> quit [root@TestPC ftp]# ls 1.txt [root@TestPC ftp]#
總結(jié)
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
apache設(shè)置自動將http跳轉(zhuǎn)到https的方法
客戶中心啟用了https的ssl證書,現(xiàn)在需要將原先的http直接跳轉(zhuǎn)到https上。這里為大家提供一個我經(jīng)常使用到的方法,即使用偽靜態(tài)功能2013-02-02
linux VPS主機(jī)上備份網(wǎng)站和數(shù)據(jù)庫的方法
現(xiàn)在看到越來越多的VPSer開始使用VPS,在使用VPS的時候一個很重要的任務(wù)就是VPS提供備份,雖然一些IDC也提供VPS的備份服務(wù),但要不就是收費(fèi),都不太適合我們這些VPSer們使用。2010-12-12
linux安裝mysql數(shù)據(jù)庫以及配置Java項目的圖文詳解
在本篇文章里小編給大家整理的是關(guān)于linux安裝mysql配置Java的相關(guān)知識點(diǎn)內(nèi)容,有需要的朋友們可以跟著學(xué)習(xí)下。2019-11-11
Linux中l(wèi)ogrotate日志輪詢操作總結(jié)
這篇文章主要給大家介紹了在Linux中l(wèi)ogrotate日志輪詢操作的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起看看吧。2017-06-06

