PhpStorm (2021+) - 通过 SSH 隧道的 SFTP

问题描述 投票:0回答:1

对于部署,我必须使用私钥连接到 SFTP

RemoteSftp.com:123

但是,我必须先使用 SSH 隧道访问

RemoteSftp.com
上的
GateSftp.com:456
以及其他用户名和其他私钥。

知道如何在 PhpStorm 中配置这种隧道吗?

phpstorm jetbrains-ide ssh-tunnel
1个回答
0
投票

据我所知,如果你可以使用

ssh remotesftp
连接到服务器,那么它应该可以在 jetbrains 中工作。

制作ssh的配置文件。在 linux/macOS 上是

~/.ssh/config
,对于 Windows 是
%HOMEPATH%\.ssh\config

# The gate ssh server
Host gatesftp
    User         root
    Port         456
    HostName     GateSftp.com
    IdentityFile /path/to/gatesftp/private/key

# The deployment server
Host remotesftp
    User         root
    Port         123
    HostName     RemoteSftp.com
    IdentityFile /path/to/remotesftp/private/key
    ProxyJump    gatesftp

注意:当您执行代理跳转时,本地计算机的密钥适用于两者。你不需要让门服务器拿着钥匙

设置完成后,可以通过执行

ssh remotesftp
确认您已连接到服务器,然后您可以在jetbrains中执行以下步骤:

  1. 转到
    File
    ->
    Settings
    ->
    Tools
    ->
    SSH Configurations
  2. 添加新的(或编辑)连接。
  3. 对于身份验证类型,选择
    OpenSSH config and authentication agent
  4. 主机:
    remotesftp
    ,端口:
    22
    ,用户名:
    root
    (奇怪的是这个有效)
© www.soinside.com 2019 - 2024. All rights reserved.