Forward from: https://www.server-world.info/en/note?os=CentOS_7&p=ftp&f=2

Thanks for your share!

[1] Install FTP Client.
[root@dlp ~]#

yum -y install lftp
[2] The connection with root account is prohibited by default, so access with an common user to FTP Server.
# lftp [option] [hostname]

[redhat@dlp ~]$

lftp -u cent www.srv.world 

Password:

# password of the user

lftp cent@www.srv.world:~>

# show current directory on FTP server

lftp cent@www.srv.world:~>

pwd

ftp://cent@www.srv.world

# show current directory on local server

lftp cent@www.srv.world:~>

!pwd

/home/redhat

# show files in current directory on FTP server

lftp cent@www.srv.world:~>

ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r-- 1 1000 1000 399 Jul 20 16:32 test.py
# show files in current directory on local server

lftp cent@www.srv.world:~>

!ls -l
total 12
-rw-rw-r-- 1 redhat redhat 10 Jul 20 14:30 redhat.txt
-rw-rw-r-- 1 redhat redhat 10 Jul 20 14:59 test2.txt
-rw-rw-r-- 1 redhat redhat 10 Jul 20 14:59 test.txt
# change directory

lftp cent@www.srv.world:~>

cd public_html

lftp cent@www.srv.world:~/public_html>

pwd

ftp://cent@www.srv.world/%2Fhome/cent/public_html

# upload a file to FTP server
# "-a" means ascii mode ( default is binary mode )

lftp cent@www.srv.world:~>

put -a redhat.txt

22 bytes transferred
Total 2 files transferred
lftp cent@www.srv.world:~>

ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r-- 1 1000 1000 10 Jul 20 17:01 redhat.txt
-rw-r--r-- 1 1000 1000 399 Jul 20 16:32 test.py
-rw-r--r-- 1 1000 1000 10 Jul 20 17:01 test.txt
# upload some files to FTP server

lftp cent@www.srv.world:~>

mput -a test.txt test2.txt

22 bytes transferred
Total 2 files transferred
lftp cent@www.srv.world:~>

ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r-- 1 1000 1000 399 Jul 20 16:32 test.py
-rw-r--r-- 1 1000 1000 10 Jul 20 17:06 test.txt
-rw-r--r-- 1 1000 1000 10 Jul 20 17:06 test2.txt
# download a file from FTP server
# "-a" means ascii mode ( default is binary mode )

lftp cent@www.srv.world:~>

get -a test.py

416 bytes transferred

# download some files from FTP server

lftp cent@www.srv.world:~>

mget -a test.txt test2.txt

20 bytes transferred
Total 2 files transferred

# create a directory in current directory on FTP Server

lftp cent@www.srv.world:~>

mkdir testdir

mkdir ok, `testdir' created
lftp cent@www.srv.world:~>

ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r-- 1 1000 1000 399 Jul 20 16:32 test.py
-rw-r--r-- 1 1000 1000 10 Jul 20 17:06 test.txt
-rw-r--r-- 1 1000 1000 10 Jul 20 17:06 test2.txt
drwxr-xr-x 2 1000 1000 6 Jul 20 17:16 testdir
226 Directory send OK.
# delete a direcroty in current directory on FTP Server

lftp cent@www.srv.world:~>

rmdir testdir

rmdir ok, `testdir' removed
lftp cent@www.srv.world:~>

ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r-- 1 1000 1000 399 Jul 20 16:32 test.py
-rw-r--r-- 1 1000 1000 10 Jul 20 17:06 test.txt
-rw-r--r-- 1 1000 1000 10 Jul 20 17:06 test2.txt
# delete a file in current directory on FTP Server

lftp cent@www.srv.world:~>

rm test2.txt

rm ok, `test2.txt' removed
lftp cent@www.srv.world:~>

ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r-- 1 1000 1000 399 Jul 20 16:32 test.py
-rw-r--r-- 1 1000 1000 10 Jul 20 17:06 test.txt
# delete some files in current directory on FTP Server

lftp cent@www.srv.world:~>

mrm redhat.txt test.txt

rm ok, 2 files removed
lftp cent@www.srv.world:~>

ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
# execute commands with "![command]"

lftp cent@www.srv.world:~>

!cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
...
...
redhat:x:1001:1001::/home/redhat:/bin/bash
# exit

lftp cent@www.srv.world:~>

quit

221 Goodbye.

How to use FTP的更多相关文章

  1. 8.仿阿里云虚拟云服务器的FTP(包括FTP文件夹大小限制)

    平台之大势何人能挡? 带着你的Net飞奔吧!:http://www.cnblogs.com/dunitian/p/4822808.html#iis 原文:http://dnt.dkill.net/Ar ...

  2. Hyper-V无法文件拖拽解决方案~~~这次用一个取巧的方法架设一个FTP来访问某个磁盘,并方便的读写文件

    异常处理汇总-服 务 器 http://www.cnblogs.com/dunitian/p/4522983.html 服务器相关的知识点:http://www.cnblogs.com/dunitia ...

  3. 阿里云学生优惠Windows Server 2012 R2安装IIS,ftp等组件,绑定服务器域名,域名解析到服务器,域名备案,以及安装期间错误的解决方案

     前言: 这几天终于还是按耐不住买了一个月阿里云的学生优惠.只要是学生,在学信网上注册过,并且支付宝实名认证,就可以用9块9的价格买阿里云的云服务ECS.确实是相当的优惠. 我买的是Windows S ...

  4. win7下利用ftp实现华为路由器的上传和下载

    win7下利用ftp实现华为路由器的上传和下载 1.  Win7下ftp的安装和配置 (1)开始->控制面板->程序->程序和功能->打开或关闭Windows功能 (2)在Wi ...

  5. Java实现FTP文件与文件夹的上传和下载

    Java实现FTP文件与文件夹的上传和下载 FTP 是File Transfer Protocol(文件传输协议)的英文简称,而中文简称为"文传协议".用于Internet上的控制 ...

  6. centos下开启ftp服务

    如果要ftp访问linux需要安装ftp服务,vsftpd是Linux下比较好的的FTP服务器. 一.检查安装vsftp //检查是否安装vsftpd rpm -qa | grep vsftpd // ...

  7. 解决开启服务器防火墙导致ftp不能连接的问题

    在防火墙设置的"高级"选项卡中的"网络连接设置"--"本地连接"--"设置"中添加了"FTP服务器" ...

  8. centos6.5 nginx-1.8.0和ftp搭建图片服务器

    一.Nginx的安装步骤 1.Nginx安装环境: gcc: 安装nginx需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gcc环境,需要安装gcc:yum install gcc-c+ ...

  9. Jenkins配置MSBuild实现自动部署(MSBuild+SVN/Subversion+FTP+BAT)

    所要用到的主要插件: [MSBuild Plugin] 具体操作: 1.配置MSBuild的版本 [系统管理]->[Global Tool Configuration]->[MSBuild ...

  10. [CentOs7]搭建ftp服务器(2)——添加用户

    摘要 上篇文章完成了ftp服务器的安装与匿名访问的内容,当然出于安全的考虑是不允许匿名访问服务器的,所以就有了本篇的内容 ,为ftp服务器添加用户,用改用户进行访问. vsftpd添加用户 FTP用户 ...

随机推荐

  1. js控制复选框checkbox 只能单选

    我们在页面经常会用到单选框,来提供单值选在字段,但是有一个问题就是:一旦选择了就不能去除(即--只要选择了就不能再以空值提交了). 所以为了解决这个问题,用复选框限制单选是一个不错的选择 <sc ...

  2. com.sun.xml.internal.ws.server.ServerRtException: Server Runtime Error: java.net.BindException: Cannot assign requested address: bind

    在发布 web service 时报错: Endpoint.publish(publishAddress, hl7MessageReveiver); com.sun.xml.internal.ws.s ...

  3. Transaction详细介绍

    闲暇之时浏览技术站点时,看到了对事物写的很好的一篇文章,看完之后感觉讲的实在是太好了. 原文地址:http://my.oschina.net/huangyong/blog/160012 Transac ...

  4. ubuntu中chromium无法播放flash,安装flash

    ubuntu14.0.4中系统自带的chromium无法播放flash,后来查了下,得知chromium已经不支持adobe flash了,用户可使用pepper flash替代.安装pepper f ...

  5. CentOS RedHat YUM 源扩展补充(32位、64位均有)

    一般情况下强烈建议在CentOS6下面使用YUM配置安装LAMP环境,一些兄弟也很喜欢使用编译的安装方法,个人觉得如果不是对服务器做定制,用yum安装稳定简单,何必去download&make ...

  6. WPF -Enum的三种绑定方法

    一.使用ObjectDataProvider <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentat ...

  7. ACM练手

    #include<iostream> #include<string.h> using namespace std; #define N 100 class stack { c ...

  8. NOIP2009最优贸易[spfa变形|tarjan 缩点 DP]

    题目描述 C 国有 n 个大城市和 m 条道路,每条道路连接这 n 个城市中的某两个城市.任意两个 城市之间最多只有一条道路直接相连.这 m 条道路中有一部分为单向通行的道路,一部分 为双向通行的道路 ...

  9. sicily 猴子选大王

    题目描述 猴子选大王,有N只猴子,从1-N进行编号.它们按照编号的顺时针方向,排成一个圆圈,然后从第一只猴子开始报数.第一只猴子报1,以后每只猴子报的数字都是它前面猴子所报数字加1.如果一只猴子报的数 ...

  10. 2016中国·西安“华山杯”WriteUp- SeeSea

    题目打包下载:https://yunpan.cn/ckyrKxHJDPAIN (提取码:bbaf) Web 1.签到(10) 扫码回复 hs_ctf拿flag, 套路题. flag_Xd{hSh_ct ...