在windows下通过xshell来实现跳板机配置pycharm环境和xftp文件访问
date
Apr 5, 2023
slug
2023-04-05
status
Published
tags
工具
summary
type
Post
xshell实现跳板机
先使用xshell实现跳板机,并将对应的跳板机窗口打开。
跳板机使用xshell的隧道功能实现,选择作为中转的服务器B的属性。
![notion image](https://www.notion.so/image/https%3A%2F%2Fimg2023.cnblogs.com%2Fblog%2F1663849%2F202304%2F1663849-20230405131855884-1199585811.png?table=block&id=c3359134-d939-4727-a075-f9ca82371c3e&cache=v2)
- 选择隧道
- 选择添加
- 侦听端口为本机A的,后面通过localhost:7777进行访问。这个端口可以自己设置不同的。
- 目标主机就是通过服务器B作为跳板机,要连接到服务器C的ip。目标端口是22,通过ssh进行连接。
这之后隧道就可以启动了,可以通过查看里的隧道窗口来看是否成功。
![notion image](https://www.notion.so/image/https%3A%2F%2Fimg2023.cnblogs.com%2Fblog%2F1663849%2F202304%2F1663849-20230405132030313-580628658.png?table=block&id=e1fd99e9-3168-4de9-ad38-a49242cf9fda&cache=v2)
pycharm配置环境
首先在setting中找到python interpreter,之后通过添加新的解释器来配置新的ssh。在下图的SSH Configurations中填入xshell隧道设置的ip和端口号。(这里不用设置要跳转到的服务器)
![notion image](https://www.notion.so/image/https%3A%2F%2Fimg2023.cnblogs.com%2Fblog%2F1663849%2F202304%2F1663849-20230405132146471-955633161.png?table=block&id=a6d061b2-a6a9-40b5-aecf-305f51ec7b92&cache=v2)
在这之后就如正常的环境添加流程一样进行设置就可以。
同理xftp上也可以这么配置。
xftp访问
配置如下
![notion image](https://www.notion.so/image/https%3A%2F%2Fimg2023.cnblogs.com%2Fblog%2F1663849%2F202304%2F1663849-20230405132336697-1601841309.png?table=block&id=d88b60a8-450c-463c-96d9-929ed7666e2c&cache=v2)