当前位置:网站首页>【服务器使用记录】通过跳板机登录远程服务器并进行文件传输
【服务器使用记录】通过跳板机登录远程服务器并进行文件传输
2022-07-28 05:24:00 【CELINE_HUANG】
说明:文章为本小白记录使用远程服务器时踩的坑,欢迎大佬批评指正
文章目录
一、生成本机密钥并添加到服务器中
首先在终端输入代码生成本机的密钥和公钥:
ssh-keygen -t rsa

会生成 id_rsa 和 id_rsa.pub,它们分别对应为你本机的公钥和密钥,我们将 id_rsa.pub 发给服务器管理人员或是上传到相应平台,即在服务器上允许你本机登录
注意:key有两种格式,一种是rsa,一种是dsa,有些服务器并不支持dsa的!
二、使用VSCode扩展插件Remote-SSH登录远程服务器
在VSCode扩展中找到插件并下载,然后点击远程资源管理器中的 ‘+’,输入:
ssh 账号名称@服务器地址 -p 端口号
如:
ssh [email protected] -p 123
然后经服务器验证fingerprint之后就能成功登录啦~
再罗嗦一下,在vscode里按 crtl+shift+` 可以打开终端(我自己找了好久)
三、通过跳板机A登录远程服务器B
1. 登录跳板机
日常开发中,为了安全性等方面考虑,连接远程服务器之前,需要先连接跳板机,这个方法与二、使用VSCode扩展插件Remote-SSH登录远程服务器一致,不多赘述。
2. 在跳板机中生成密钥
想要通过跳板机登录远程服务器很关键的一点是,不仅你本机的密钥需要上传到跳板机A,跳板机A上也需要生成一个密钥上传到远程服务器B(我第一次使用就没有把跳板机的密钥上传,所以死活登录不上去)
同样的方法:打开跳板机的终端输入ssh-keygen -t rsa
四、通过跳板机把数据迁移到远程服务器B上
传输文件:scp 文件名 用户名@服务器B的IP地址:服务器B上的目的地址
scp test.py [email protected]:/home/huang/
传输文件夹:scp -r 文件名 用户名@服务器B的地址:服务器B上的目的地址
scp test/folder [email protected]:/home/huang/
五、在VSCode里配置跳板机和目标机
Host JumpMachine
HostName 1.1.1.1
User root
Port 22
Host TargetMachine
HostName 1.1.1.1
User root
ProxyCommand ssh -W %h:%p JumpMachine
六、参考
https://blog.csdn.net/weixin_34790159/article/details/116557869
边栏推荐
- A NOVEL DEEP PARALLEL TIME-SERIES RELATION NETWORK FOR FAULT DIAGNOSIS
- 杭州某公司福禄克FLUKE DTX-SFM2单模模块-修复案例
- ESXi on ARM v1.2 (2020年11月更新)
- Reversible watermarking method based on difference expansion
- Terminal resistance detailed signal complete series hardware learning notes 7
- EIGamal cryptosystem description
- WebService出错 Maximum message size quota for incoming messages (65536) has been exceeded.已超过传入消息(655
- (PHP graduation project) based on PHP Gansu tourism website management system to obtain
- Perl入门学习(十一)文件操作
- 硬件电路设计学习笔记2--降压电源电路
猜你喜欢

set_false_path

AEM testpro K50 and south Guangdong survey

set_clock_groups

PLC的选型

set_case_analysis

Learning notes of hardware circuit design 1 -- temperature rise design

Varistor design parameters and classic circuit recording hardware learning notes 5

EfficientNET_V1

arduino 读取模拟电压_MQ2气体/烟雾传感器如何工作及其与Arduino接口

4、 Model optimizer and inference engine
随机推荐
(PHP graduation project) based on PHP Gansu tourism website management system to obtain
TVs tube parameters and selection
Web scrolling subtitles (marquee example)
In asp Usage of cookies in. Net
TCL和ELTCL?CDNEXT和CMRL?
Efficient Net_V2
RS232 RS485 RS422 通信 学习及备忘笔记
ASP. Net read database bound to treeview recursive mode
set_false_path
福禄克DSX2-5000 网络线缆测试仪为什么每年都要校准一次?
Ctfshow single dog -- Web
DSX-PC6跳线模块,何时更换JACK插座?
Fluke fluke aircheck WiFi tester cannot configure file--- Ultimate solution experience
(PHP graduation design) obtained based on PHP fruit sales store management system
BERT基于transformer的双向编码器
CString to char[] function
Agilent Agilent e5071 test impedance and attenuation are normal, except crosstalk ng--- Repair plan
Varistor design parameters and classic circuit recording hardware learning notes 5
Web滚动字幕(MARQUEE示例)
Electric fast burst (EFT) design - EMC series hardware design notes 4