{"id":412,"date":"2018-04-29T16:12:34","date_gmt":"2018-04-29T15:12:34","guid":{"rendered":"http:\/\/blog.chen-hongyi.com\/?p=412"},"modified":"2018-04-29T16:12:34","modified_gmt":"2018-04-29T15:12:34","slug":"ssh-r-%e5%ae%9e%e7%8e%b0%e7%ab%af%e5%8f%a3%e6%98%a0%e5%b0%84","status":"publish","type":"post","link":"https:\/\/chen-hongyi.com\/?p=412","title":{"rendered":"SSH -R \u5b9e\u73b0\u7aef\u53e3\u6620\u5c04"},"content":{"rendered":"<p>\u4eca\u5929\u5728\u8fdb\u884c\u8fdc\u7a0b\u8c03\u8bd5\u7684\u65f6\u5019\uff0c\u53d1\u73b0\u672c\u5730\u7684IDE\u7684debug\u7aef\u53e39000\u4e00\u76f4\u65e0\u6cd5\u6536\u5230\u670d\u52a1\u5668\u7684\u56de\u53eb\uff0e\u3000\u5728\u670d\u52a1\u5668\u7aef\u67e5\u770b\u4e86xdebug\u7684log,\u6709\u9519\u8bef\u4fe1\u606f\uff0c\u662f\u8bf4\u65e0\u6cd5\u94fe\u63a5\u6211\u76849000\u7aef\u53e3\uff0e\u3000\u6211\u770b\u4e86ip\u548cport\u90fd\u662f\u6b63\u786e\u7684\uff0e\uff49\uff50\u662f\u7684telekom\u7684\uff52\uff4f\uff55\uff54\uff45\uff52\u3000ip,\u5e94\u8be5\u662fport\u88ab\u9632\u706b\u5899\u963b\u9694\u4e86\u5427\uff0e<\/p>\n<p>\u6211\u60f3\u4ee5\u524d\u4e00\u76f4\u662f\u7528vagrant\u6765\u5de5\u4f5c\uff0c\u867d\u7136\u8c03\u8bd5\u7684\u65b9\u6cd5\u4e5f\u662f\u8fdc\u7a0bremote\u3000debug, \u4f46\u662f\u672c\u8d28\u90fd\u662f\u5728\u672c\u5730\u4e00\u4e2a\u7f51\u7edc\u73af\u5883\u5185\uff0e\u3000\u4eca\u5929\u662f\u771f\u6b63\u7684remote\u3000debug\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u662f\u4e00\u4e2a\u5728\u6211\u672c\u5730\u4ee5\u5916\u7684\u4e00\u4e2a\u751f\u4ea7\u73af\u5883\u7684\u673a\u5668\uff0e\uff08\u4e0d\u8981\u95ee\u6211\u4e3a\u4ec0\u4e48\u8981\u8981\u5728\u751f\u4ea7\u73af\u5883\uff44\uff45\uff42\uff55\uff47\uff09<\/p>\n<p>\u7136\u540e\u641c\u4e86\u4e00\u4e0b\uff0c\u53d1\u73b0\u5176\u5b9e\u6709\u89e3\u51b3\u7684\u529e\u6cd5\u7684\u3000\uff08<a href=\"https:\/\/confluence.jetbrains.com\/display\/PhpStorm\/Remote+debugging+in+PhpStorm+via+SSH+tunnel\">\u94fe\u63a5<\/a>\uff09\uff0c\u5c31\u662f\u7528ssh\u7aef\u53e3\u6620\u5c04\uff0c\u628a\u8fdc\u7aef\u7684port\u6620\u5c04\u5230\u672c\u5730\u6765\uff0e\u4f7f\u7528ssh -R \u5373\u53ef\uff0e<\/p>\n<blockquote><p>\n\u3000\u3000\u3000-R [bind_address:]port:host:hostport<br \/>\n     -R [bind_address:]port:local_socket<br \/>\n     -R remote_socket:host:hostport<br \/>\n     -R remote_socket:local_socket<br \/>\n             Specifies that connections to the given TCP port or Unix socket<br \/>\n             on the remote (server) host are to be forwarded to the given host<br \/>\n             and port, or Unix socket, on the local side.  This works by allo\u2010<br \/>\n             cating a socket to listen to either a TCP port or to a Unix<br \/>\n             socket on the remote side.  Whenever a connection is made to this<br \/>\n             port or Unix socket, the connection is forwarded over the secure<br \/>\n             channel, and a connection is made to either host port hostport,<br \/>\n             or local_socket, from the local machine.<\/p>\n<p>             Port forwardings can also be specified in the configuration file.<br \/>\n             Privileged ports can be forwarded only when logging in as root on<br \/>\n             the remote machine.  IPv6 addresses can be specified by enclosing<br \/>\n             the address in square brackets.<\/p>\n<p>             By default, TCP listening sockets on the server will be bound to<br \/>\n             the loopback interface only.  This may be overridden by specify\u2010<br \/>\n             ing a bind_address.  An empty bind_address, or the address \u2018*\u2019,<br \/>\n             indicates that the remote socket should listen on all interfaces.<br \/>\n             Specifying a remote bind_address will only succeed if the<br \/>\n             server&#8217;s GatewayPorts option is enabled (see sshd_config(5)).<\/p>\n<p>             If the port argument is \u20180\u2019, the listen port will be dynamically<br \/>\n             allocated on the server and reported to the client at run time.<br \/>\n             When used together with -O forward the allocated port will be<br \/>\n             printed to the standard output.<\/p>\n<\/blockquote>\n<p>\u8fd9\u6837\uff0c\u5b9e\u73b0\u4e86\u5728<strong>\u547d\u4ee4\u884c<\/strong>\u4e0b\u7684remote debug\uff0e\u4f46\u662f\u4f46\u662f\uff0c\u6d4f\u89c8\u5668\u4f3c\u4e4e\u4e00\u76f4\u8fd8\u662f\u4e0d\u884c\uff0e\u6211\u628a\u6d4f\u89c8\u5668\u6539\u4e3a\u901a\u8fc7socket\u4ee3\u7406\uff0c\u4f3c\u4e4e\u8fd8\u5b58\u5728\u95ee\u9898\uff0e\u3000<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u5728\u8fdb\u884c\u8fdc\u7a0b\u8c03\u8bd5\u7684\u65f6\u5019\uff0c\u53d1\u73b0\u672c\u5730\u7684IDE\u7684debug\u7aef\u53e39000\u4e00\u76f4\u65e0\u6cd5\u6536\u5230\u670d &hellip; <a href=\"https:\/\/chen-hongyi.com\/?p=412\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-412","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts\/412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=412"}],"version-history":[{"count":1,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts\/412\/revisions"}],"predecessor-version":[{"id":413,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts\/412\/revisions\/413"}],"wp:attachment":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}