{"id":1314,"date":"2012-04-18T16:12:35","date_gmt":"2012-04-18T23:12:35","guid":{"rendered":"http:\/\/xiehang.com\/blog\/?p=1314"},"modified":"2012-04-18T16:12:35","modified_gmt":"2012-04-18T23:12:35","slug":"connect-to-production-servers","status":"publish","type":"post","link":"https:\/\/xiehang.com\/blog\/2012\/04\/18\/connect-to-production-servers\/","title":{"rendered":"Connect to production servers"},"content":{"rendered":"

Here’s the whole command, with IP address masked:<\/p>\n


\nssh -A -t 111.111.111.111 \"LD_PRELOAD= ssh -A -p 58422 222.222.222.222 -t \\\"SSH_AUTH_SOCK=\\\\\\$(find \/tmp -user xiehang -a -type s 2>\/dev\/null | xargs ls -tr | tail -1) ssh -p 58422 -l root $@\\\"\"
\n<\/code><\/p>\n

where 111.111.111.111 is jump host in office, and 222.222.222.222 is jump host in the IDC.<\/p>\n

Tricks here: jump host in office is running tsocks, so I have to reset LD_PRELOAD to disable it, and jump host in IDC set default shell to eash (for audit) so I have to setup the ssh agent manually.<\/p>\n

It took me 20 minutes to figure out all quotes and backslashes \ud83d\ude41 .<\/p>\n","protected":false},"excerpt":{"rendered":"

Here’s the whole command, with IP address masked: ssh -A -t 111.111.111.111 “LD_PRELOAD= ssh -A -p 58422 222.222.222.222 -t \\”SSH_AUTH_SOCK=\\\\\\$(find \/tmp -user xiehang -a -type s 2>\/dev\/null | xargs ls -tr | tail -1) ssh -p 58422 -l root $@\\”” where 111.111.111.111 is jump host in office, and 222.222.222.222 is jump host in the IDC. […]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9,325],"_links":{"self":[{"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/posts\/1314"}],"collection":[{"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/comments?post=1314"}],"version-history":[{"count":1,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/posts\/1314\/revisions"}],"predecessor-version":[{"id":1315,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/posts\/1314\/revisions\/1315"}],"wp:attachment":[{"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/media?parent=1314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/categories?post=1314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/tags?post=1314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}