How to SSH with ProxyJump in Linux

photo of jumping man

Secure Shell (SSH) is a widely used protocol for remotely connecting to a computer system, typically over a network. It provides encrypted communication and authentication to ensure secure access to a remote machine. In this article, we will discuss how to SSH with ProxyJump in Linux.

ProxyJump is a feature in OpenSSH which allows you to connect to a remote machine via an intermediate host or jump host. It can be used to simplify the process of accessing a remote machine that is behind a firewall or NAT.

How to SSH Jump

To use ProxyJump, you need to have SSH access to both the intermediate and remote hosts. Once you have access, you can use the following syntax to establish a connection to the remote host:

ssh -J intermediate_user@intermediate_host remote_user@remote_host -p remote_port

Here’s a breakdown of the command options:

  • -J intermediate_user@intermediate_host specifies the intermediate host and the user account to use for authentication.
  • remote_user@remote_host specifies the remote host and the user account to use for authentication.
  • -p remote_port specifies the port number on the remote host to connect to.

Let’s Jump!

Let’s say we want to connect to a remote host with IP address 10.0.1.100 via an intermediate host with IP address 10.0.2.200 and username user. We can use the following command to establish the connection:

ssh -J user@10.0.2.200 user@10.0.1.100

This command will use the user account user to connect to the intermediate host with IP address 10.0.2.200. Once authenticated, it will establish a connection to the remote host with IP address 10.0.1.100 using the same user account.

Note that the ssh command will use the default SSH port 22 unless otherwise specified. If the remote host uses a different SSH port, you can use the -p option to specify the port number. For example, to connect to a remote host on port 2222, use the following command:

ssh -J user@10.0.2.200 user@10.0.1.100 -p 2222

SSH with ProxyJump is a powerful feature in OpenSSH that allows you to establish secure connections to remote hosts via intermediate hosts. With this feature, you can easily connect to a remote machine that is behind a firewall or NAT. Hope this helps. 🙂

,

Leave a Reply

Your email address will not be published. Required fields are marked *