{"id":777,"date":"2020-01-02T07:42:50","date_gmt":"2020-01-02T07:42:50","guid":{"rendered":"http:\/\/www.liutianfeng.com\/?p=777"},"modified":"2020-01-02T07:42:50","modified_gmt":"2020-01-02T07:42:50","slug":"ssh%e5%85%8d%e5%af%86%e7%99%bb%e5%bd%95-%e5%85%ac%e9%92%a5%e7%a7%81%e9%92%a5%e8%ae%a4%e8%af%81","status":"publish","type":"post","link":"https:\/\/www.liutianfeng.com\/?p=777","title":{"rendered":"ssh\u514d\u5bc6\u767b\u5f55 \u516c\u94a5\u79c1\u94a5\u8ba4\u8bc1"},"content":{"rendered":"<p>\u4e3b\u673a\uff1a192.168.111.133<\/p>\n<p>\u672c\u5b9e\u9a8c\u662f\u5f53\u524d\u4e3b\u673a\u7684root\u7528\u6237\u548clius\u7528\u4e8e\u4e4b\u95f4\u7684\u514d\u5bc6\u914d\u7f6e\u3002<\/p>\n<h4>\u7b2c\u4e00\u6b65\uff1a\u751f\u6210\u5bc6\u94a5<\/h4>\n<p># ssh-keygen -t rsa -P &#8221; -f ~\/.ssh\/id_rsa<br \/>\n-t: \u7c7b\u578brsa<br \/>\n-P &#8221;: \u5bc6\u94a5\u6587\u4ef6\u4e0d\u52a0\u5bc6\uff0c\u7f3a\u7701\u4e0d\u52a0\u5bc6\uff0c\u4f46\u9700\u8981\u989d\u5916\u6572\u56de\u8f66\u3002<br \/>\n-f: \u5bc6\u94a5\u6587\u4ef6\u7684\u5b58\u653e\u4f4d\u7f6e\uff0c\u9ed8\u8ba4\u5c31\u662f~\/.ssh\/\uff0c\u53ef\u4ee5\u4e0d\u6307\u5b9a\uff0c\u4f46\u9700\u8981\u989d\u5916\u6572\u56de\u8f66\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\"># ssh-keygen -t rsa -P '' -f ~\/.ssh\/id_rsa\r\nGenerating public\/private rsa key pair.\r\nYour identification has been saved in \/root\/.ssh\/id_rsa.\r\nYour public key has been saved in \/root\/.ssh\/id_rsa.pub.\r\nThe key fingerprint is:\r\na4:2d:6d:31:79:c2:a1:f4:66:e0:3b:77:c6:17:d0:ca [MD5] root@linux-t7tx\r\nThe key's randomart image is:\r\n+--[ RSA 2048]----+\r\n|      o . ..     |\r\n|     o = o ..    |\r\n|      o @....    |\r\n|       O *E  .   |\r\n|      = S + .    |\r\n|       = o .     |\r\n|                 |\r\n|                 |\r\n|                 |\r\n+--[MD5]----------+<\/code><\/pre>\n<h4>\u7b2c\u4e8c\u6b65\uff1a\u590d\u5236\u516c\u94a5\u5230\u670d\u52a1\u7aef<\/h4>\n<pre class=\"pure-highlightjs\"><code class=\"\"># ssh-copy-id -i ~\/.ssh\/id_rsa.pub lius@192.168.111.133\r\n\/usr\/bin\/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed\r\n\/usr\/bin\/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys\r\nPassword: \r\n\r\nNumber of key(s) added: 1\r\n\r\nNow try logging into the machine, with:   \"ssh 'lius@192.168.111.133'\"\r\nand check to make sure that only the key(s) you wanted were added.<\/code><\/pre>\n<h4>\u7b2c\u4e09\u6b65\uff1a\u9a8c\u8bc1<\/h4>\n<pre class=\"pure-highlightjs\"><code class=\"\"># ssh -i ~\/.ssh\/id_rsa lius@192.168.111.133 \"echo Hello\"\r\nHello\r\n-i:\u00a0\u6307\u5b9a\u79c1\u94a5\u7684\u4f4d\u7f6e\uff0c\u7f3a\u7701\u8def\u5f84\u5c31\u662f\uff1a~\/.ssh\/id_rsa\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u5bc6\u94a5\u7684\u5b58\u653e\u4f4d\u7f6e\u9ed8\u8ba4\u7684\u8bdd\uff0c\u65e0\u9700\u6307\u5b9a\u3002\r\n # ssh lius@192.168.111.133 \"echo Hello\"\r\nHello<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1a<a href=\"https:\/\/www.liutianfeng.com\">liutianfeng.com<\/a> &raquo; <a href=\"https:\/\/www.liutianfeng.com\/?p=777\">ssh\u514d\u5bc6\u767b\u5f55 \u516c\u94a5\u79c1\u94a5\u8ba4\u8bc1<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u4e3b\u673a\uff1a192.168.111.133 \u672c\u5b9e\u9a8c\u662f\u5f53\u524d\u4e3b\u673a\u7684root\u7528\u6237\u548clius\u7528\u4e8e\u4e4b\u95f4\u7684\u514d\u5bc6\u914d\u7f6e\u3002 \u7b2c\u4e00\u6b65\uff1a\u751f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=\/wp\/v2\/posts\/777"}],"collection":[{"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=777"}],"version-history":[{"count":1,"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=\/wp\/v2\/posts\/777\/revisions"}],"predecessor-version":[{"id":778,"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=\/wp\/v2\/posts\/777\/revisions\/778"}],"wp:attachment":[{"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=777"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=777"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.liutianfeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=777"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}