{"id":17253,"date":"2015-03-20T08:00:32","date_gmt":"2015-03-19T23:00:32","guid":{"rendered":"http:\/\/www.sssg.org\/blogs\/hiro345\/?p=17253"},"modified":"2015-03-21T05:21:38","modified_gmt":"2015-03-20T20:21:38","slug":"ssh-copy-id%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%81%a7%e5%85%ac%e9%96%8b%e9%8d%b5%e3%82%92%e7%99%bb%e9%8c%b2%e3%81%97%e3%82%88%e3%81%86","status":"publish","type":"post","link":"https:\/\/www.hiro345.net\/blogs\/hiro345\/archives\/17253.html","title":{"rendered":"ssh-copy-id\u30b3\u30de\u30f3\u30c9\u3067\u516c\u958b\u9375\u3092\u767b\u9332\u3057\u3088\u3046"},"content":{"rendered":"<p>\u30ea\u30e2\u30fc\u30c8\u30ed\u30b0\u30a4\u30f3\u306f\u6700\u8fd1\u306fSSH\u304c\u5e38\u8b58\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u6bce\u56de\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3059\u308b\u306e\u306f\u9762\u5012\u3060\u3068\u3044\u3046\u3053\u3068\u3067\u3001ssh-agent\u3068\u516c\u958b\u9375\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3044\u308b\u4eba\u3082\u591a\u3044\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u516c\u958b\u9375\u3092\u5229\u7528\u3059\u308b\u306b\u306f\u3001\u30ea\u30e2\u30fc\u30c8\u30db\u30b9\u30c8\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u306e~\/.ssh\/authorized_keys\u30d5\u30a1\u30a4\u30eb\u3078\u516c\u958b\u9375\u3092\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u8ffd\u52a0\u3092\u624b\u8efd\u306b\u3059\u308b\u306b\u306f\u3001ssh-copy-id\u30b3\u30de\u30f3\u30c9\u304c\u4fbf\u5229\u3067\u3059\u3002\u305f\u3060\u3057\u3001ssh-copy-id\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3046\u5834\u5408\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u3084\u30db\u30b9\u30c8\u8a8d\u8a3c\u306a\u3069\u3067\u3059\u3067\u306b\u30ed\u30b0\u30a4\u30f3\u306f\u3067\u304d\u308b\u74b0\u5883\u306b\u306a\u3063\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u904b\u7528\u74b0\u5883\u3067\u5229\u7528\u3059\u308b\u306b\u306f\u3001\u5c11\u3057\u5fae\u5999\u3067\u3059\u306d\u3002<\/p>\n<p>\u304a\u305d\u3089\u304f\u521d\u671f\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u6642\u306b\u4e00\u6642\u7684\u306b\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u3092\u6709\u52b9\u306b\u3057\u3066\u304a\u3044\u3066\u3001\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u5f8c\u306b\u516c\u958b\u9375\u65b9\u5f0f\u306e\u307f\u3078\u5207\u308a\u66ff\u3048\u308b\u3068\u3044\u3063\u305f\u4f7f\u3044\u65b9\u304c\u591a\u3044\u306f\u305a\u3067\u3059\u3002<br \/>\n<!--more--><br \/>\n\u904b\u7528\u74b0\u5883\u3067\u306f\u306a\u304f\u958b\u767a\u74b0\u5883\u306e\u5834\u5408\u306f\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u3067\u306e\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u3057\u3066\u3042\u3063\u3066\u3082\u3001\u516c\u958b\u9375\u3067\u306e\u30a2\u30af\u30bb\u30b9\u306e\u65b9\u304c\u697d\u306a\u306e\u3067\u3001\u3053\u308c\u3092\u6709\u52b9\u306b\u3057\u305f\u3044\u3068\u3044\u3046\u5834\u5408\u306b\u306f\u7a4d\u6975\u7684\u306b\u5229\u7528\u3057\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n<p>\u4f7f\u3044\u65b9\u306f\u7c21\u5358\u3067\u3059\u3002\u305f\u3068\u3048\u3070\u3001user001\u30e6\u30fc\u30b6\u304c\u3001host001\u306b\u3042\u308b\u540c\u540d\u30a2\u30ab\u30a6\u30f3\u30c8\u306e~\/.ssh\/authorized_keys\u30d5\u30a1\u30a4\u30eb\u3078\u516c\u958b\u9375\u3092\u8ffd\u52a0\u3059\u308b\u306b\u306f\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u7c21\u5358\u3067\u3059\u306d\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\n$ ssh-copy-id host001\r\nuser001@host001&#039;s password: \r\nNow try logging into the machine, with &quot;ssh &#039;host001&#039;&quot;, and check in:\r\n\r\n  .ssh\/authorized_keys\r\n\r\nto make sure we haven&#039;t added extra keys that you weren&#039;t expecting.\r\n<\/pre>\n<p>ssh-copy-id\u3092\u4f7f\u308f\u306a\u3044\u5834\u5408\u306f\u3001.ssh\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4f5c\u6210\u304b\u3089\u5fc5\u8981\u3067\u3001\u6b21\u306e\u3088\u3046\u306a\u624b\u9806\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\n$ ssh host001 mkdir .ssh\r\n$ ssh host001 chmod 700 .ssh\r\n$ cat ~\/.ssh\/id_rsa.pub | ssh host001 &#039;cat &gt;&gt; ~\/.ssh\/authorized_keys; chmod 600 ~\/.ssh\/authorized_keys&#039;\r\nThe authenticity of host &#039;host001 (192.168.0.11)&#039; can&#039;t be established.\r\n(\u7565)\r\nAre you sure you want to continue connecting (yes\/no)? yes \u2190 yes\u3068\u5165\u5bee\r\nWarning: Permanently added &#039;node3,192.168.33.13&#039; (RSA) to the list of known hosts.\r\nuser001@host001&#039;s password: \u2190 host001\u306euser001\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\uff08\u8868\u793a\u3055\u308c\u306a\u3044\uff09\r\n<\/pre>\n<p>\u30ed\u30fc\u30ab\u30eb\u30db\u30b9\u30c8\u306e~\/.ssh\/id_rsa.pub\u306b\u306f\u516c\u958b\u9375\u306e\u60c5\u5831\u304c\u3042\u308a\u3001\u3053\u308c\u3092\u30ea\u30e2\u30fc\u30c8\u30db\u30b9\u30c8\u306e~\/.ssh\/authorizedkeys\u3078\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059\u3002\u30ea\u30e2\u30fc\u30c8\u30db\u30b9\u30c8\u306eauthorizedkeys\u306b\u306f\u8907\u6570\u306e\u516c\u958b\u9375\u304c\u767b\u9332\u3067\u304d\u307e\u3059\u3002\u65e2\u5b58\u306e\u60c5\u5831\u3092\u6d88\u3055\u306a\u3044\u3088\u3046\u306b\u8ffd\u52a0\u30e2\u30fc\u30c9\u3067\u66f8\u304d\u8fbc\u3080\u306e\u304c\u57fa\u672c\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067\u3001ssh\u30b3\u30de\u30f3\u30c9\u3067\u30ea\u30e2\u30fc\u30c8\u30db\u30b9\u30c8\u3078\u63a5\u7d9a\u3059\u308b\u3068\u3001\u516c\u958b\u9375\u65b9\u5f0f\u3067\u306e\u30ed\u30b0\u30a4\u30f3\u306b\u306a\u308a\u307e\u3059\u3002ssh-agent\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3068\u3001\u30d1\u30b9\u30d5\u30ec\u30fc\u30ba\u306e\u5165\u529b\u30921\u5ea6\u3059\u308c\u3070\u3001\u305d\u308c\u4ee5\u964d\u306f\u30d1\u30b9\u30d5\u30ec\u30fc\u30ba\u5165\u529b\u3092\u7701\u7565\u3057\u3066\u30ed\u30b0\u30a4\u30f3\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4e0b\u8a18\u3082\u53c2\u8003\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li><a type=\"amzn\" asin=\"4774168076\">OpenSSH[\u5b9f\u8df5]\u5165\u9580 (Software Design plus) <\/a><\/li>\n<li><a type=\"amzn\" asin=\"4873112877\">\u5b9f\u7528SSH \u7b2c2\u7248\u2015\u30bb\u30ad\u30e5\u30a2\u30b7\u30a7\u30eb\u5fb9\u5e95\u6d3b\u7528\u30ac\u30a4\u30c9 <\/a><\/li>\n<\/ul>\n<div>\n<iframe loading=\"lazy\" style=\"width: 120px; height: 240px;\" src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&amp;o=9&amp;p=8&amp;l=as1&amp;asins=4774168076&amp;ref=tf_til&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr\" height=\"240\" width=\"320\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><iframe loading=\"lazy\" style=\"width: 120px; height: 240px;\" src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&amp;o=9&amp;p=8&amp;l=as1&amp;asins=4873112877&amp;ref=tf_til&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr\" height=\"240\" width=\"320\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u30ea\u30e2\u30fc\u30c8\u30ed\u30b0\u30a4\u30f3\u306f\u6700\u8fd1\u306fSSH\u304c\u5e38\u8b58\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u6bce\u56de\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3059\u308b\u306e\u306f\u9762\u5012\u3060\u3068\u3044\u3046\u3053\u3068\u3067\u3001ssh-agent\u3068\u516c\u958b\u9375\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3044\u308b\u4eba\u3082\u591a\u3044\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002 \u516c\u958b\u9375\u3092\u5229\u7528\u3059\u308b\u306b\u306f\u3001\u30ea\u30e2\u30fc\u30c8\u30db\u30b9\u30c8\u306e\u30a2\u30ab &hellip; <a href=\"https:\/\/www.hiro345.net\/blogs\/hiro345\/archives\/17253.html\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[1209,520,198],"class_list":["post-17253","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux","tag-openssh","tag-ssh"],"_links":{"self":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/17253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/comments?post=17253"}],"version-history":[{"count":4,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/17253\/revisions"}],"predecessor-version":[{"id":17270,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/17253\/revisions\/17270"}],"wp:attachment":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/media?parent=17253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/categories?post=17253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/tags?post=17253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}