Centos服務(wù)器搭建簡(jiǎn)單的ftp服務(wù)實(shí)踐
Centos服務(wù)器搭建簡(jiǎn)單的ftp服務(wù)
實(shí)現(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、通過(guò)三個(gè)工具下載文件
實(shí)現(xiàn)過(guò)程
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)兩個(gè)防火墻
[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)頁(yè)內(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)頁(yè)內(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 用時(shí) 0s
2025-03-14 12:11:49 (0.00 B/s) - “2.txt.1” 已保存 [0]
4、使用lftp工具下載FTP網(wǎng)頁(yè)內(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é)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Centos7學(xué)習(xí)之添加用戶和用戶組的方法
本篇文章主要介紹了Centos7學(xué)習(xí)之添加用戶和用戶組的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-09-09
Linux文件基本屬性知識(shí)點(diǎn)總結(jié)
這篇文章主要介紹了Linux文件基本屬性知識(shí)點(diǎn)總結(jié),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-05-05
Centos中root密碼重置的實(shí)現(xiàn)及步驟詳解
這篇文章主要介紹了Centos中root密碼重置的實(shí)現(xiàn)及步驟詳解的相關(guān)資料,需要的朋友可以參考下2017-07-07
讓Apache支持shtml實(shí)現(xiàn)include文件解析的配置方法
Apache支持include文件解析shtml首先要應(yīng)該修改Apache配置文件httpd.conf2011-03-03
Linux軟硬鏈接和動(dòng)靜態(tài)庫(kù)詳解
本文詳細(xì)介紹了Linux系統(tǒng)中目錄、軟鏈接、硬鏈接、.和..、靜態(tài)庫(kù)和動(dòng)態(tài)庫(kù)的概念及其使用方法,通過(guò)實(shí)際操作和示例,幫助讀者理解這些概念在Linux系統(tǒng)中的應(yīng)用2025-02-02

