{"id":2887,"date":"2021-08-04T23:41:45","date_gmt":"2021-08-04T15:41:45","guid":{"rendered":"http:\/\/space.sofasay.com\/?p=2887"},"modified":"2022-03-10T10:14:25","modified_gmt":"2022-03-10T02:14:25","slug":"vscode-remote-ssh","status":"publish","type":"post","link":"http:\/\/blog.sofasay.com\/?p=2887","title":{"rendered":"VSCode Remote SSH"},"content":{"rendered":"<p>VSCode\u7528\u987a\u624b\u4e86, \u5c31\u4e0d\u613f\u610f\u518d\u6298\u817e\u6362\u5176\u5b83\u7684\u5f00\u53d1IDE\u4e86. \u4f46\u6700\u8fd1\u51e0\u4e2a\u7248\u672c\u7684Remote SSH\u8001\u662f\u51fa\u95ee\u9898. \u5bf9\u4e8e\u6211\u8fd9\u79cd\u5728Windows \u684c\u9762\u4e0a\u8fdb\u884cLinux\u5f00\u53d1\u7684\u91cd\u5ea6\u4f9d\u8d56\u4eba\u5458\u6765\u8bf4, \u8fdc\u7a0b\u8c03\u8bd5\u51fa\u95ee\u9898\u4e25\u91cd\u5f71\u54cd\u6548\u7387\u554a.\u00a0 GitHub\u4e0a\u6709Issue,\u4e5f\u6709\u89e3\u51b3\u529e\u6cd5, \u4f46\u90fd\u4e0d\u957f\u4e45.<\/p>\n<p>\u6298\u817e\u4e86\u4e0b, \u6700\u5408\u9002\u7684\u529e\u6cd5\u5c31\u662f\u5b89\u88c5\u67d0\u4e2a\u8001\u7248\u672c, \u5728\u8fd9\u91cc\u4e0b\u8f7dhttps:\/\/code.visualstudio.com\/updates\/v1_58<\/p>\n<p>\u7136\u540e \u88c5\u4e0a\u9700\u8981\u7684\u63d2\u4ef6 (Remote SSH, Window Colors, YAML, GitLens)<\/p>\n<p>\u7136\u540e\u5728settings\u91cc\u641c\u7d22update, \u7981\u6b62\u81ea\u52a8\u5347\u7ea7, \u5347\u7ea7\u6a21\u5f0f\u9009none<\/p>\n<p>===20220310 update<\/p>\n<p>\u80fd\u4e0d\u80fd\u8bbe\u7f6e\u514d\u5bc6\u7801\u767b\u9646?\u4e0d\u8981\u6bcf\u6b21\u8fde\u63a5\u90fd\u8981\u8f93\u5165\u5bc6\u7801.<\/p>\n<p>1. Windows\u4e0a\u751f\u6210\u516c\u94a5 (id_rsa.pub).<\/p>\n<p>mkdir -p ~\/.ssh &amp;&amp; cd ~\/.ssh\/ &amp;&amp; ssh-keygen<\/p>\n<p>2. \u4e0a\u4f20\u516c\u94a5\u5230\u8981\u8fde\u63a5\u7684\u670d\u52a1\u5668<\/p>\n<p>ssh-copy-id -i ~\/.ssh\/id_rsa.pub root@192.168.235.22<br \/>\n3. VSCode\u8bbe\u7f6e\u9ed8\u8ba4~\/.ssh\/config<\/p>\n<div>\n<div>Host\u00a0dev-213<\/div>\n<div>\u00a0\u00a0\u00a0\u00a0HostName 11.111.78.213<\/div>\n<div>\u00a0\u00a0\u00a0\u00a0User\u00a0root<\/div>\n<div>\u00a0\u00a0\u00a0\u00a0IdentityFile\u00a0~\/.ssh\/id_rsa<\/div>\n<div>4. \u8fdc\u7a0b\u6253\u5f00Folder\u65f6\u53ef\u80fd\u63d0\u793a Permissions for &#8216;C:\\\\Users\\\\admin\/.ssh\/id_rsa&#8217; are too open. \u5219\u9700\u8981\u5728Windows\u4e0a\u79fb\u9664\u4e0d\u76f8\u5e72\u4eba\u5458\u6743\u9650.\u00a0 cmd\u4e0b\u8fd0\u884c. <a href=\"https:\/\/superuser.com\/questions\/1309447\/how-to-secure-ssh-private-key-on-windows-10\">ref<\/a><\/div>\n<div>\n<pre class=\"lang-bash s-code-block\"><code class=\"hljs language-bash\">::<span class=\"hljs-comment\"># Set Key File Variable:<\/span>\r\n    Set Key=<span class=\"hljs-string\">\"%UserProfile%\\.ssh\\id_rsa\"<\/span>\r\n\r\n::<span class=\"hljs-comment\"># Remove Inheritance:<\/span>\r\n    Icacls %Key% \/c \/t \/Inheritance:d\r\n\r\n::<span class=\"hljs-comment\"># Set Ownership to Owner:<\/span>\r\n    Icacls %Key% \/c \/t \/Grant %UserName%:F\r\n\r\n::<span class=\"hljs-comment\"># Remove All Users, except for Owner:<\/span>\r\n    Icacls %Key%  \/c \/t \/Remove Administrator BUILTIN\\Administrators BUILTIN Everyone System Users\r\n\r\n::<span class=\"hljs-comment\"># Verify:<\/span>\r\n    Icacls %Key%\r\n\r\n::<span class=\"hljs-comment\"># Remove Variable:<\/span>\r\n    <span class=\"hljs-built_in\">set<\/span> <span class=\"hljs-string\">\"Key=\"<\/span><\/code><\/pre>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VSCode\u7528\u987a\u624b\u4e86, \u5c31\u4e0d\u613f\u610f\u518d\u6298\u817e\u6362\u5176\u5b83\u7684\u5f00\u53d1IDE\u4e86. \u4f46\u6700\u8fd1\u51e0\u4e2a\u7248\u672c\u7684Remote SSH\u8001\u662f\u51fa\u95ee\u9898. &hellip; <a href=\"http:\/\/blog.sofasay.com\/?p=2887\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cVSCode Remote SSH\u201d<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[1],"tags":[],"views":147,"_links":{"self":[{"href":"http:\/\/blog.sofasay.com\/index.php?rest_route=\/wp\/v2\/posts\/2887"}],"collection":[{"href":"http:\/\/blog.sofasay.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.sofasay.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.sofasay.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.sofasay.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2887"}],"version-history":[{"count":0,"href":"http:\/\/blog.sofasay.com\/index.php?rest_route=\/wp\/v2\/posts\/2887\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.sofasay.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.sofasay.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2887"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.sofasay.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}