[Linux](EN) Access server via proxy server or jump host server using SSH ProxyJump

Access server via proxy server or jump host using ProxyJump


Environment and Prerequisite

  • Linux
  • SSH


ProxyJump

Purpose

Many systems use proxy or jump host to connect production server due to security. It is comfortable to use ProxyJump rather than use ssh command separately.


Usage

  • Format
Host [proxy server name]
    HostName [proxy or jump host domain or ip address]
    Port [port number]
    User [username]
    IdentityFile [proxy or jump host identity key file]

Host [remote server name]
    HostName [server domain or ip address]
    Port [port number]
    User [username]
    IdentityFile [server identity key file]
    ProxyJump [proxy server name]


Example

  • Local -> proxy-server -> remote-server
  • Both IdentityFile should be located in Local.
  • Below case is only for example. In real production, Local -> proxy-server is usually public network and proxy-server -> remote-server is usually private network.
Host proxy-server
    HostName 192.168.64.3
    Port 22
    User twpower
    IdentityFile ~/.ssh/proxy-server

Host remote-server
    HostName 192.168.64.4
    Port 22
    User twpower
    IdentityFile ~/.ssh/remote-server
    ProxyJump proxy-server
  • Access direct to remote-server
ssh remote-server


Reference