SSH Tunnel Jump Hosts as Root
by metallica1973 from LinuxQuestions.org on (#598K6)
Hello Linux Gods,
I can successfully access my target manually by going through 2 different ssh jump hosts as root:
Code:user@server1.com#>sudo su -p
root@server1#>then sshing as root to the target server
Code:root@server1#> ssh server2
root@server2#>Normally, I use tunneling from my local browser to access the web app residing on a particular service that the jump box can access like:
Code:ex.
ssh -L 12022:192.168.3.55:443 -J user1@server1 user1@server2but cannot do this as root or at least have not been able to figure it out. Since these are secure jump boxes, I am only allowed accessing the final jump box (server2.com) as root by first becoming the root user on the first jump box (server1). I cannot access my destination jump box (server2) directly as root.
My question is how can I do all of this with a one-liner using ssh? What is the trick?
??


I can successfully access my target manually by going through 2 different ssh jump hosts as root:
Code:user@server1.com#>sudo su -p
root@server1#>then sshing as root to the target server
Code:root@server1#> ssh server2
root@server2#>Normally, I use tunneling from my local browser to access the web app residing on a particular service that the jump box can access like:
Code:ex.
ssh -L 12022:192.168.3.55:443 -J user1@server1 user1@server2but cannot do this as root or at least have not been able to figure it out. Since these are secure jump boxes, I am only allowed accessing the final jump box (server2.com) as root by first becoming the root user on the first jump box (server1). I cannot access my destination jump box (server2) directly as root.
My question is how can I do all of this with a one-liner using ssh? What is the trick?
??