{"id":422,"date":"2007-10-11T02:30:45","date_gmt":"2007-10-10T17:30:45","guid":{"rendered":"http:\/\/ecpplus.net\/weblog\/?p=422"},"modified":"2021-07-15T14:58:39","modified_gmt":"2021-07-15T05:58:39","slug":"openssh%e3%81%a7%e3%83%88%e3%83%b3%e3%83%8d%e3%83%aa%e3%83%b3%e3%82%b0","status":"publish","type":"post","link":"https:\/\/ecpplus.net\/weblog\/openssh%e3%81%a7%e3%83%88%e3%83%b3%e3%83%8d%e3%83%aa%e3%83%b3%e3%82%b0\/","title":{"rendered":"OpenSSH\u3067\u30c8\u30f3\u30cd\u30ea\u30f3\u30b0"},"content":{"rendered":"<p>\u3000\u5916\u90e8\u304b\u3089\u898b\u3048\u306a\u3044\u30b5\u30fc\u30d0\u3078\u3064\u306a\u3050\u5fc5\u8981\u304c\u3042\u3063\u3066\u3001SSH\u306e\u30c8\u30f3\u30cd\u30ea\u30f3\u30b0\u3068\u3044\u3046\u306e\u3092\u3084\u3063\u3066\u307f\u305f\u3002<\/p>\n<h2>Mac,Linux\u306e\u5834\u5408<\/h2>\n<p>\u3000\u9bd61 (<code>example.com<\/code>) \u3067SSH\u30b5\u30fc\u30d0\u304c\u52d5\u3044\u3066\u3066\u3001\u30b0\u30ed\u30fc\u30d0\u30ebIP\u30a2\u30c9\u30ec\u30b9\u3092\u6301\u305f\u306a\u3044\u304c\u9bd61\u3068\u540c\u3058\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u3044\u308b\u9bd62(<code>192.168.1.10<\/code>) \u306b\u3064\u306a\u304e\u305f\u3044\u3001\u3068\u3044\u3046\u5834\u5408 SSH\u30c8\u30f3\u30cd\u30ea\u30f3\u30b0\u3059\u308b\u3068\u9bd62\u306b\u76f4\u63a5\u63a5\u7d9a\u3064\u306a\u3044\u3067\u3044\u308b\u304b\u306e\u3088\u3046\u306b\u6271\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p>\u4eca\u3001\u624b\u5143\u304b\u3089 \u9bd62 \u306e MySQL \u30b5\u30fc\u30d0\u306b\u3064\u306a\u304e\u3050\u5834\u5408\u306e\u4f8b\u3067\u3059\u3002MySQL\u306e\u30dd\u30fc\u30c8\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e 3306 \u3068\u3057\u3001\u9bd61\u304b\u3089\u63a5\u7d9a\u304c\u53ef\u80fd\u306a\u72b6\u6cc1\u3068\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3059\u308b\u3068\u3001\u81ea\u5206\u306e\u30de\u30b7\u30f3\u306e 19000\u756a\u30dd\u30fc\u30c8\u304c SSH\u30c8\u30f3\u30cd\u30eb\u3092\u7d4c\u7531\u3057\u3066\u9bd62\u306e3306\u756a \u30dd\u30fc\u30c8\u306b\u7e4b\u304c\u308a\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-sh\">$ ssh -L19000:192.168.1.10:3306 example.com -l username<\/code><\/pre>\n<p><code>-L<\/code> \u306f\u30ed\u30fc\u30ab\u30eb\u306e\u30dd\u30fc\u30c8\u6307\u5b9a\u3001<code>-l<\/code> \u306f example.com \u306eSSH\u306e\u30e6\u30fc\u30b6\u540d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u8a73\u7d30\u306a\u66f8\u5f0f\u306f\u3001\u4e0b\u8a18\u3067\u3059\u3002<\/p>\n<pre><code>ssh -L{\u30ed\u30fc\u30ab\u30eb\u306e\u30dd\u30fc\u30c8\u756a\u53f7}:{\u9bd62\u306e\u3001\u9bd61\u304b\u3089\u898b\u305fhost}:{\u9bd62\u3067\u63a5\u7d9a\u3057\u305f\u3044\u30dd\u30fc\u30c8\u756a\u53f7} {\u9bd61\u306ehost} -l {\u9bd61\u306bSSH\u3059\u308b\u969b\u306e\u30e6\u30fc\u30b6\u540d}<\/code><\/pre>\n<p>\u3053\u306e\u3068\u304d\u3001\u9bd61\u306b\u63a5\u7d9a\u53ef\u80fd\u306a\u72b6\u614b\u3067\u3042\u308c\u3070OK\u3067\u3059\u3002\u9375\u8a8d\u8a3c\u3067\u3082\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u3067\u3082\u554f\u984c\u306a\u3044\u3067\u3059\u3002\u9bd61\u304b\u3089\u9bd62\u306e\u30dd\u30fc\u30c8\u306b\u63a5\u7d9a\u53ef\u80fd\u3067\u3042\u308c\u3070\u3001SSH\u30c8\u30f3\u30cd\u30ea\u30f3\u30b0\u306f\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<p>\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001SSH\u3067\u901a\u5e38\u306e\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u306e\u3068\u540c\u3058\u72b6\u614b\u306b\u306a\u308a\u307e\u3059\u304c\u3001\u9589\u3058\u3066\u3057\u307e\u3046\u3068\u30c8\u30f3\u30cd\u30eb\u3082\u9589\u3058\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u305d\u306e\u307e\u307e\u306b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u304f\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b -f -N \u3092\u4ed8\u3051\u3066\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u5b9f\u884c\u3055\u305b\u3066\u304a\u304f\u3053\u3068\u3082\u51fa\u6765\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-sh\">$ ssh -f -N -L19000:192.168.1.10:3306 example.com -l username<\/code><\/pre>\n<p>SSH\u304c\u3064\u306a\u304c\u3063\u305f\u5f8c\u306f\u3001localhost \u306e 19000\u756a\u30dd\u30fc\u30c8\u3078MySQL\u3067\u3064\u306a\u304e\u306b\u3044\u304f\u3068\u3001\u9bd62\u306e3306\u756a\u30dd\u30fc\u30c8\u306bMySQL\u3057\u305f\u306e\u3068\u540c\u3058\u3088\u3046\u306b\u3064\u306a\u304c\u308a\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-sh\">$ mysql -u testuser -p --port=19000 -h 127.0.0.1<\/code><\/pre>\n<p>\u3053\u306e\u4f8b\u306f MySQL \u3067\u3059\u304c\u3001\u6ce8\u610f\u70b9\u3068\u3057\u3066\u306f\u30db\u30b9\u30c8(-h\u30aa\u30d7\u30b7\u30e7\u30f3)\u3092 127.0.0.1\u306b\u6307\u5b9a\u3059\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002\u30c7\u30d5\u30a9\u3067localhost\u306a\u306e\u306b\uff1f\u3068\u601d\u3046\u3093\u3067\u3059\u304c\u3001MySQL\u306f localhost \u3068 127.0.0.1 \u306e\u6271\u3044\u304c\u9055\u3044\u307e\u3059\u3002localhost \u306f \u30ed\u30fc\u30ab\u30eb\u306e\u30bd\u30b1\u30c3\u30c8\u3092\u901a\u3057\u3066\u63a5\u7d9a\u3092\u884c\u306a\u3046\u306e\u3067\u3059\u304c\u3001127.0.0.1 \u306fTCP\u30bd\u30b1\u30c3\u30c8\u3067127.0.0.1\u3067\u63a5\u7d9a\u3092\u884c\u306a\u3044\u307e\u3059\u3002\u4eca\u56de\u306f\u3001\u30ed\u30fc\u30ab\u30eb\u306e\u30bd\u30b1\u30c3\u30c8\u3067\u3064\u306a\u3050\u306e\u3067\u306f\u306a\u304f\u3001TCP\u30bd\u30b1\u30c3\u30c8\u3067\u3064\u306a\u3050\u3053\u3068\u306b\u306a\u308b\u306e\u3067\u660e\u793a\u7684\u306b <code>-h 127.0.0.1<\/code> \u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2>Windows\u306e\u5834\u5408(PuTTY\u4f7f\u3046\u4f8b)<\/h2>\n<p>Windows \u306e PuTTY \u3067\u3082SSH\u30c8\u30f3\u30cd\u30ea\u30f3\u30b0\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p>\u5148\u307b\u3069\u306e\u69cb\u6210\u3068\u540c\u3058\u5834\u5408\u306e PuTTY \u306e\u8a2d\u5b9a\u65b9\u6cd5\u3067\u3059\u3002\u3064\u306a\u3050\u753b\u9762\u306e \u63a5\u7d9a -&gt; SSH -&gt; \u30c8\u30f3\u30cd\u30eb \u3068\u3044\u3046\u9805\u76ee\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001\u6e90\u30dd\u30fc\u30c8(\u81ea\u5206\u306e\u30de\u30b7\u30f3\u3067LISTEN\u3059\u308b\u4efb\u610f\u306e\u30dd\u30fc\u30c8)\u3068\u9001\u308a\u5148\u30dd\u30fc\u30c8(SSH\u30ed\u30b0\u30a4\u30f3\u5148\u304b\u3089\u898b\u305f\u30db\u30b9\u30c8\u3068\u30dd\u30fc\u30c8)\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p><a href='http:\/\/ecpplus.net\/weblog\/wp-content\/uploads\/2007\/10\/image02.PNG' title='putty\u8a2d\u5b9a'><img data-src='http:\/\/ecpplus.net\/weblog\/wp-content\/uploads\/2007\/10\/image02.PNG' alt='putty\u8a2d\u5b9a' src='data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==' class='lazyload' \/><\/a><\/p>\n<p>\u3053\u306e\u72b6\u614b\u3067\u666e\u901a\u306bSSH\u3067\u3064\u306a\u3050\u3068\u304d\u3068\u540c\u3058\u3088\u3046\u306b\u30db\u30b9\u30c8\u540d\u3044\u308c\u3066\u3001\u30e6\u30fc\u30b6\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3059\u308c\u3070SSH\u3067\u30ed\u30b0\u30a4\u30f3\u3055\u308c\u307e\u3059\u3002\u5148\u307b\u3069\u3068\u540c\u69d8\u306b\u3001\u3053\u306e\u72b6\u614b\u3067\u30c8\u30f3\u30cd\u30eb\u304c\u51fa\u6765\u3066\u3044\u308b\u306e\u3067\u3001PuTTY \u306f\u9589\u3058\u306a\u3044\u3067\u305d\u306e\u307e\u307e\u306b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u3042\u3068\u306fMySQL\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3067127.0.0.1\u306e19000\u756a\u30dd\u30fc\u30c8\u3078\u3064\u306a\u304e\u306b\u884c\u3051\u3070\u3064\u306a\u304c\u308a\u307e\u3059\u3002<\/p>\n<p>DB\u3084\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u306f\u8e0f\u307f\u53f0\u30b5\u30fc\u30d0\u7d4c\u7531\u3067\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u304c\u591a\u3044\u306e\u3067\u3001SSH\u30c8\u30f3\u30cd\u30ea\u30f3\u30b0\u306e\u8a2d\u5b9a\u3092 <code>.ssh\/config<\/code> \u306b\u66f8\u3044\u3066\u304a\u304f\u3068\u4fbf\u5229\u306a\u3053\u3068\u3082\u591a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3000\u5916\u90e8\u304b\u3089\u898b\u3048\u306a\u3044\u30b5\u30fc\u30d0\u3078\u3064\u306a\u3050\u5fc5\u8981\u304c\u3042\u3063\u3066\u3001SSH\u306e\u30c8\u30f3\u30cd\u30ea\u30f3\u30b0\u3068\u3044\u3046\u306e\u3092\u3084\u3063\u3066\u307f\u305f\u3002 Mac,Linux\u306e\u5834\u5408 \u3000\u9bd61 (example.com) \u3067SSH\u30b5\u30fc\u30d0\u304c\u52d5\u3044\u3066\u3066\u3001\u30b0\u30ed\u30fc\u30d0\u30ebIP\u30a2\u30c9\u30ec\u30b9\u3092\u6301\u305f\u306a\u3044\u304c\u9bd61\u3068\u540c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[7,12,11,13],"class_list":["post-422","post","type-post","status-publish","format-standard","hentry","category-development","tag-linux","tag-mac","tag-tool","tag-windows"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/posts\/422","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/comments?post=422"}],"version-history":[{"count":2,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/posts\/422\/revisions"}],"predecessor-version":[{"id":4341,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/posts\/422\/revisions\/4341"}],"wp:attachment":[{"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/media?parent=422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/categories?post=422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/tags?post=422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}