Windows11 - 使用 sftp连接 CentOS 7,实现文件上传与下载
文章目录
前言一、连接服务器二、sftp连接服务器,实现文件上传与下载
前言
Windows系统的cmd命令实现远程连接服务器,并且使用 sftp连接 CentOS 7,实现文件上传与下载
一、连接服务器
注意:下方所有
文章目录
- 前言
- 一、连接服务器
- 二、sftp连接服务器,实现文件上传与下载
前言
Windows系统的cmd命令实现远程连接服务器,并且使用 sftp连接 CentOS 7,实现文件上传与下载
一、连接服务器
注意:下方所有服务器ip,均为示例ip
Microsoft Windows [版本 10.0.22621.96]
(c) Microsoft Corporation。保留所有权利。
C:\Users\nanyi> -p 22 root@8.161.180.227
root@8.161.180.227 s password:
Last failed login: Tue Jan 10 12:21:59 CST 202 from 122.80.26.116 on :notty
There were 24 failed login attempts since the last successful login.
Last login: Sun Dec 18 14:5:25 2022 from 126.21.74.5
Welcome to Alibaba Cloud Elastic Compute Service !
-bash: export: `/usr/local/software/nginx-1.21.6/sbin : not a valid identifier
[root@izbp1gqo24yvt8e065uxz ~]# dir
get-docker.sh logs tmall_logs
[root@izbp1gqo24yvt8e065uxz ~]# cd /
[root@izbp1gqo24yvt8e065uxz /]# dir
bin dev home lib64 media mynacos proc run srv tmall usr 菜谱.txt
boot etc lib lostfound mnt opt root sbin sys tmp var
这样就成功连接上服务器,不过命令和Linux上命令有所区别
二、sftp连接服务器,实现文件上传与下载
如下(示例):
C:\Users\nanyi>sftp root@8.161.180.227
root@8.161.180.227 s password:
Connected to 8.161.180.227.
sftp>
注意:sftp> 表示已经进入 sftp 的交互模式。
连接成功之后,使用 pwd 命令查看远程服务器上的当前工作目录:
sftp> pwd
Remote working directory: /root
使用 ls 命令查看远程服务器上的当前工作目录下的文件:
sftp> ls -l
lrwxrwxrwx 1 root root 7 Aug 18 2017 bin
dr-xr-xr-x 4 root root 4096 Sep 12 2017 boot
drwxr-xr-x 19 root root 2980 Jan 21 2022 dev
drwxr-xr-x 85 root root 4096 Feb 14 2022 etc
drwxrwxrwx root root 4096 Jun 15 2021 home
lrwxrwxrwx 1 root root 7 Aug 18 2017 lib
lrwxrwxrwx 1 root root 9 Feb 5 2021 lib64
drwx------ 2 root root 1684 Aug 18 2017 lostfound
drwxr-xr-x 2 root root 4096 ov 5 2016 media
drwxr-xr-x 2 root root 4096 ov 5 2016 mnt
drwxr-xr-x 7 root root 4096 Feb 8 2022 mynacos
-rw-r--r-- 1 root root 1 Apr 8 2022 菜谱.txt
使用 lpwd 命令查看本地服务器上的当前工作目录:
sftp> lpwd
Local working directory: c:\users\nanyi
使用 lcd 命令切换到本机指定工作目录:
sftp> lcd D:\
sftp> lpwd
Local working directory: d:\
使用 lls 命令查看本机指定目录下的文件:
sftp> lls D:\
2022/12/09 16:44 <DIR> nanyi_rust_projects
2021/10/16 1:44 <DIR> Pr
2021/01/26 21:44 <DIR> questionnaire
2022/12/22 15: <DIR> software
2022/07/06 17:48 <DIR> spring-framework-5.2.x
sftp>
使用 put 命令将本机上指定目录下的文件上传到远程服务器上当前目录下
sftp> put test.txt
Uploading test.txt to /test.txt
test.txt 100% 0 0.0KB/s 00:00
sftp> ls -l
lrwxrwxrwx 1 root root 7 Aug 18 2017 bin
dr-xr-xr-x 4 root root 4096 Sep 12 2017 boot
drwxr-xr-x 19 root root 2980 Jan 21 2022 dev
drwxr-xr-x 85 root root 4096 Feb 14 2022 etc
drwxrwxrwx root root 4096 Jun 15 2021 home
lrwxrwxrwx 1 root root 7 Aug 18 2017 lib
lrwxrwxrwx 1 root root 9 Feb 5 2021 lib64
-rw-r--r-- 1 root root 1 Apr 8 2022 菜谱.txt
-rw-r--r-- 1 root root 0 Jan 10 19:2 test.txt
使用 get 命令从远程服务器上下载指定文件到本地服务器
sftp> ls -l
lrwxrwxrwx 1 root root 7 Aug 18 2017 bin
dr-xr-xr-x 4 root root 4096 Sep 12 2017 boot
drwxr-xr-x 19 root root 2980 Jan 21 2022 dev
drwxr-xr-x 85 root root 4096 Feb 14 2022 etc
drwxrwxrwx root root 4096 Jun 15 2021 home
lrwxrwxrwx 1 root root 7 Aug 18 2017 lib
lrwxrwxrwx 1 root root 9 Feb 5 2021 lib64
-rw-r--r-- 1 root root 1 Apr 8 2022 菜谱.txt
-rw-r--r-- 1 root root 0 Jan 10 19:2 test.txt
sftp> lpwd
Local working directory: d:\
sftp> get 菜谱.txt
Fetching /菜谱.txt to 菜谱.txt
/菜谱.txt 100% 1 0.5KB/s 00:00
sftp> lls
Volume in drive D is Data
Volume Serial umber is FE47-6B17
Directory of D:\
2022/12/09 16:44 <DIR> nanyi_rust_projects
2021/10/16 1:44 <DIR> Pr
2021/01/26 21:44 <DIR> questionnaire
2022/12/22 15: <DIR> software
2022/07/06 17:48 <DIR> spring-framework-5.2.x
202/01/11 10:4 1 菜谱.txt
可以看到 “菜谱.txt” 文件已经下载到了本地!
#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格
上传时间: 2025-07-18 00:45:34
推荐阅读
留言与评论(共有 12 条评论) |
本站网友 投资金条 | 4分钟前 发表 |
/root 使用 ls 命令查看远程服务器上的当前工作目录下的文件: sftp> ls -l lrwxrwxrwx 1 root root 7 Aug 18 2017 bin dr-xr-xr-x 4 root root 4096 Sep 12 2017 boot drwxr-xr-x 19 root root 2980 Jan 21 2022 dev drwxr-xr-x 85 root root 4096 Feb 14 2022 etc drwxrwxrwx root root 4096 Jun 15 2021 home lrwxrwxrwx 1 root root 7 Aug 18 2017 lib lrwxrwxrwx 1 root root 9 Feb 5 2021 lib64 drwx------ 2 root root 1684 Aug 18 2017 lostfound drwxr-xr-x 2 root root 4096 ov 5 2016 media drwxr-xr-x 2 root root 4096 ov 5 2016 mnt drwxr-xr-x 7 root root 4096 Feb 8 2022 mynacos -rw-r--r-- 1 root root 1 Apr 8 2022 菜谱.txt 使用 lpwd 命令查看本地服务器上的当前工作目录: sftp> lpwd Local working directory | |
本站网友 华润中心 | 19分钟前 发表 |
export | |
本站网友 广州的旅行社 | 12分钟前 发表 |
59 CST 202 from 122.80.26.116 on | |
本站网友 武夷新区 | 27分钟前 发表 |
c | |
本站网友 门静脉高压症 | 6分钟前 发表 |
C | |
本站网友 博客空间 | 3分钟前 发表 |
d | |
本站网友 涨幅偏离值 | 25分钟前 发表 |
\Users\nanyi> -p 22 root@8.161.180.227 root@8.161.180.227 s password | |
本站网友 孔侑 | 14分钟前 发表 |
\Users\nanyi> -p 22 root@8.161.180.227 root@8.161.180.227 s password | |
本站网友 孕妇晚期食谱 | 18分钟前 发表 |
sftp连接服务器,实现文件上传与下载 如下(示例): C | |
本站网友 布病是什么病 | 25分钟前 发表 |
Connected to 8.161.180.227. sftp> 注意:sftp> 表示已经进入 sftp 的交互模式 | |
本站网友 醋花生米 | 20分钟前 发表 |
\users\nanyi 使用 lcd 命令切换到本机指定工作目录: sftp> lcd D |