{"id":2789,"date":"2023-04-25T15:37:06","date_gmt":"2023-04-25T06:37:06","guid":{"rendered":"https:\/\/derrylab.com\/?p=2789"},"modified":"2023-05-01T02:26:29","modified_gmt":"2023-04-30T17:26:29","slug":"how-to-ssh-with-proxyjump-in-linux","status":"publish","type":"post","link":"https:\/\/blog.derrylab.com\/index.php\/2023\/04\/25\/how-to-ssh-with-proxyjump-in-linux\/","title":{"rendered":"How to SSH with ProxyJump in Linux"},"content":{"rendered":"<p>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.<\/p>\n<p>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.<\/p>\n<h2>How to SSH Jump<\/h2>\n<p>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:<\/p>\n<pre><code class=\"line-numbers\">ssh -J intermediate_user@intermediate_host remote_user@remote_host -p remote_port\n<\/code><\/pre>\n<p>Here&#8217;s a breakdown of the command options:<\/p>\n<ul>\n<li><code>-J intermediate_user@intermediate_host<\/code> specifies the intermediate host and the user account to use for authentication.<\/li>\n<li><code>remote_user@remote_host<\/code> specifies the remote host and the user account to use for authentication.<\/li>\n<li><code>-p remote_port<\/code> specifies the port number on the remote host to connect to.<\/li>\n<\/ul>\n<h2>Let&#8217;s Jump!<\/h2>\n<p>Let&#8217;s say we want to connect to a remote host with IP address <code>10.0.1.100<\/code> via an intermediate host with IP address <code>10.0.2.200<\/code> and username <code>user<\/code>. We can use the following command to establish the connection:<\/p>\n<pre><code class=\"line-numbers\">ssh -J user@10.0.2.200 user@10.0.1.100\n<\/code><\/pre>\n<p>This command will use the user account <code>user<\/code> to connect to the intermediate host with IP address <code>10.0.2.200<\/code>. Once authenticated, it will establish a connection to the remote host with IP address <code>10.0.1.100<\/code> using the same user account.<\/p>\n<p>Note that the <code>ssh<\/code> command will use the default SSH port 22 unless otherwise specified. If the remote host uses a different SSH port, you can use the <code>-p<\/code> option to specify the port number. For example, to connect to a remote host on port <code>2222<\/code>, use the following command:<\/p>\n<pre><code class=\"line-numbers\">ssh -J user@10.0.2.200 user@10.0.1.100 -p 2222\n<\/code><\/pre>\n<p>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. \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2804,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4,5],"tags":[],"class_list":["post-2789","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-programming"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/04\/pexels-photo-2736809.jpeg?fit=1880%2C1253&ssl=1","jetpack-related-posts":[{"id":3171,"url":"https:\/\/blog.derrylab.com\/index.php\/2023\/12\/18\/how-to-enable-browsing-when-you-have-ssh-access\/","url_meta":{"origin":2789,"position":0},"title":"How to Enable Browsing when You Have SSH Access","author":"derry","date":"December 18, 2023","format":false,"excerpt":"Introduction If you have access to SSH into a machine, it means you have full control of that machine. However if not all of the things can be done via terminal SSH, sometimes you need to browse some sites using that machine connection. The simplest solution for this is to\u2026","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"view of tunnel","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/12\/pexels-photo-249097.jpeg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/12\/pexels-photo-249097.jpeg?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/12\/pexels-photo-249097.jpeg?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/12\/pexels-photo-249097.jpeg?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/12\/pexels-photo-249097.jpeg?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":127,"url":"https:\/\/blog.derrylab.com\/index.php\/2020\/11\/17\/how-to-fix-raspberry-pi-ssh-hangs-or-not-responding\/","url_meta":{"origin":2789,"position":1},"title":"How to Fix Raspberry Pi SSH Hangs or Not Responding","author":"derry","date":"November 17, 2020","format":false,"excerpt":"I just set up a Raspberry PI 4 Model B in the laboratory to automatically connect to the lab's router. I found that each random minutes the SSH is hangs and not responding. Adding IPQoS cs0 cs0 line to the end of \/etc\/ssh\/sshd_config file will fix the issue. :)","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":100,"url":"https:\/\/blog.derrylab.com\/index.php\/2020\/08\/19\/git-tutorial-how-to-push-to-a-new-repository\/","url_meta":{"origin":2789,"position":2},"title":"GIT Tutorial: How to Push to a New Repository","author":"derry","date":"August 19, 2020","format":false,"excerpt":"Set up your global git configuration first. git config --global user.name \"Your Name\" git config --global user.email \"id@your.site\" If you want to create a new repository: git clone ssh:\/\/id@your.site\/some-repo.git cd some-repo touch README.md git add README.md git commit -m \"add README\" git push -u origin master Or just push the\u2026","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":135,"url":"https:\/\/blog.derrylab.com\/index.php\/2020\/11\/18\/how-to-start-a-fresh-raspberry-pi-without-monitor\/","url_meta":{"origin":2789,"position":3},"title":"How to Start a Fresh Raspberry Pi without Monitor","author":"derry","date":"November 18, 2020","format":false,"excerpt":"I mean using SSH because HDMI, mouse, keyboard, and monitor will eat up the whole space in my desk. Prepare the Raspberry Pi OS Firstly we need to get our microSD card with bootable Raspberry Pi OS. I recommend using Raspberry Pi Imager to make this process easier. We just\u2026","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2020\/11\/image.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2020\/11\/image.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2020\/11\/image.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":213,"url":"https:\/\/blog.derrylab.com\/index.php\/2021\/09\/27\/git-pristine-how-to-pristine-clean-your-dirty-git-repository\/","url_meta":{"origin":2789,"position":4},"title":"Git Pristine: How to Pristine Clean Your Dirty Git Repository","author":"derry","date":"September 27, 2021","format":false,"excerpt":"I found this command useful and I love this alias! git pristine, a command that will wipe any dirt on your local git copy, any untracked files, and the cache will be removed to make it pristine clean as the remote origin. Now, each time you messed up your repository,\u2026","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2021\/09\/pexels-pixabay-48889.jpg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2021\/09\/pexels-pixabay-48889.jpg?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2021\/09\/pexels-pixabay-48889.jpg?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2021\/09\/pexels-pixabay-48889.jpg?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2021\/09\/pexels-pixabay-48889.jpg?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":2242,"url":"https:\/\/blog.derrylab.com\/index.php\/2022\/10\/18\/how-to-do-buffer-overflow-attack-on-64bit-machine\/","url_meta":{"origin":2789,"position":5},"title":"How to Do Buffer Overflow Attack on 64bit Machine","author":"derry","date":"October 18, 2022","format":false,"excerpt":"Professor's course material was out of date. He made an example of a buffer overflow attack several years ago. Then here I am, asked to fix the code to work on a modern machine, 64bit Kali Linux. There should be no difference with other Linux; you can practice this on\u2026","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"giant tsunami wave","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts\/2789","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/comments?post=2789"}],"version-history":[{"count":5,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts\/2789\/revisions"}],"predecessor-version":[{"id":2822,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts\/2789\/revisions\/2822"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/media\/2804"}],"wp:attachment":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/media?parent=2789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/categories?post=2789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/tags?post=2789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}