\u8bed\u6cd5\u770b\u4e0a\u53bb\u5f88\u6b7b\u677f\u7d2f\u8d58\uff0c\u5176\u5b9e\u7528\u4e0d\u5230\u90a3\u4e48\u591a\u3002\u4e60\u60ef\u4e2d\u5c31\u53ea\u7528\u8fd9\u4e2a<\/p>\n
ssh name@server-ip<\/pre>\n\u6216\u8005<\/p>\n
ssh server-ip -l name<\/pre>\n\u4ee5\u4e0a\u4e24\u79cd\u65b9\u5f0f\u90fd\u53ef\u4ee5\u8fdc\u7a0b\u767b\u5f55\u5230\u670d\u52a1\u5668\uff0cserver-ip\u4ee3\u8868\u8fdc\u7a0b\u670d\u52a1\u5668\u7684IP\u5730\u5740\uff0cname\u4ee3\u8868SSH\u767b\u9646\u8fdb\u8fdc\u7a0b\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\uff0c\u4e00\u822c\u4e3aroot\u3002<\/p>\n
\u5982\u679c\u8fdc\u7a0b\u670d\u52a1\u5668\u7684\u7aef\u53e3\u662f\u5176\u4ed6\u7684\uff0c\u5728\u540e\u9762\u52a0\u4e0a-p\u53c2\u6570\u3002<\/p>\n
ssh name@server-ip -p 12345<\/pre>\n\u8fde\u63a5\u6210\u529f\u7ec8\u7aef\u5c31\u4f1a\u63d0\u793a\u7ee7\u7eed\u8f93\u5165\u7528\u6237\u5bc6\u7801\uff0c\u8f93\u5165\u5c31\u597d\u4e86\u3002<\/p>\n
SSH\u4f7f\u7528\u516c\u94a5\u514d\u5bc6\u767b\u9646<\/strong><\/div>\nSSH\u767b\u5f55\u65f6\u6709\u4e24\u79cd\u9a8c\u8bc1\u65b9\u5f0f<\/div>\n
\n
\n- \u57fa\u4e8e\u5bc6\u7801\u7684\u5b89\u5168\u9a8c\u8bc1\uff0c\u5b83\u8981\u6c42\u7528\u6237\u5728\u6bcf\u6b21\u767b\u5f55\u670d\u52a1\u5668\u65f6\u8f93\u5165\u5bc6\u7801\uff0c\u670d\u52a1\u5668\u7aef\u9a8c\u8bc1\u901a\u8fc7\u540e\u5373\u767b\u5f55\u6210\u529f\u3002<\/li>\n
- \u57fa\u4e8e\u5bc6\u94a5\u7684\u5b89\u5168\u9a8c\u8bc1\uff0c\u5ba2\u6237\u7aef\u7684\u516c\u94a5\u4f1a\u9884\u5148\u4fdd\u5b58\u5728\u670d\u52a1\u5668\u7aef\uff0c\u5f53\u767b\u5f55\u65f6\uff0c\u670d\u52a1\u5668\u7aef\u4f1a\u4f7f\u7528\u8be5\u516c\u94a5\u505a\u9a8c\u8bc1\uff0c\u5982\u679c\u9a8c\u8bc1\u6210\u529f\uff0c\u7528\u6237\u4e0d\u9700\u8f93\u5165\u5bc6\u7801\u5373\u5b8c\u6210\u767b\u5f55\u3002<\/li>\n<\/ol>\n
\u4e3a\u4e86\u907f\u514d\u6bcf\u6b21\u90fd\u8f93\u5165\u5bc6\u7801\u8fd9\u79cd\u91cd\u590d\u6027\u5de5\u4f5c\uff0c\u6211\u4eec\u53ef\u4ee5\u9009\u62e9\u4f7f\u7528\u516c\u94a5\u8fdb\u884c\u8fdc\u7a0b\u767b\u5f55\u3002<\/p>\n
\u672c\u5730\u751f\u6210\u5bc6\u94a5\u5bf9\u7ec8\u7aef\u6267\u884c
\nssh-keygen<\/code>
\n\u7136\u540e\u4e00\u8def\u56de\u8f66\u5c31\u884c\u4e86\uff0c\u56de\u8f66\u5c31\u662f\u5c06\u5bc6\u94a5\u5bf9\u4fdd\u5b58\u4f4d\u7f6e\u548c\u6253\u5f00\u5bc6\u7801\u9ed8\u8ba4\u8bbe\u7f6e\u3002\u6267\u884c\u5b8c\u6bd5\u4f1a\u63d0\u793a\u540d\u4e3aid_rsa\u548cid_rsa.pub\u7684\u79c1\u94a5\u6587\u4ef6\u548c\u516c\u94a5\u6587\u4ef6\u5728\/home\/user\/.ssh\u76ee\u5f55\u4e0b\u3002<\/p>\n\u7136\u540e\u5c06\u516c\u94a5\u4e0a\u4f20\u5230\u8fdc\u7a0b\u670d\u52a1\u5668<\/p>\n
ssh-copy-id root@server-ip<\/pre>\nserver-ip\u4e3a\u8fdc\u7a0b\u670d\u52a1\u5668\u7684IP\u5730\u5740\u3002\u7136\u540e\u6839\u636e\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u5f53\u770b\u5230\u7ec8\u7aef\u663e\u793a<\/p>\n
\r\nNumber of key(s) added: 1\r\n\r\nNow try logging into the machine, with: \"ssh 'root@remoteserver\"\r\nand check to make sure that only the key(s) you wanted were added.\r\n<\/pre>\n\u4ee3\u8868\u4e0a\u4f20\u6210\u529f\uff0c\u63a5\u7740\u4f60\u53ef\u4ee5\u53ea\u7528\u4f7f\u7528\u201cssh root@server-ip\u201d\u547d\u4ee4\u76f4\u63a5\u767b\u9646\u8fdc\u7a0b\u670d\u52a1\u5668,\u800c\u4e0d\u9700\u8981\u5bc6\u7801\u4e86<\/p>\n<\/div>\n
\u5bf9\u8fdc\u7a0b\u670d\u52a1\u5668\u8bbe\u7f6e\u522b\u540d\u767b\u9646<\/strong><\/div>\n\u5c31\u7b97\u662f\u8bbe\u7f6e\u514d\u5bc6\u767b\u9646\uff0cSSH\u547d\u4ee4\u540e\u9762\u9700\u8981\u5e26\u7684server-ip\u4e5f\u591f\u9ebb\u70e6\u7684\uff0c\u8fc7\u51e0\u5e74\u666e\u53caIPV6\u5730\u5740\uff0cssh\u767b\u9646\u4e00\u6b21\u5c31\u6b32\u4ed9\u6b32\u6b7b\u7684\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u670d\u52a1\u5668\u522b\u540d\u7684\u65b9\u5f0f\u8fdb\u4e00\u6b65\u514d\u8f93\u670d\u52a1\u5668\u7684IP\u5730\u5740\u3002<\/div>\n
\u5728\/home\/user\/.ssh\/\u76ee\u5f55\u4e0b\u65b0\u5efaconfig\u6587\u4ef6,\u5185\u5bb9\u5982\u4e0b\uff1a<\/div>\n
Host hostname\r\nHostName server-ip\r\nUser root\r\nIdentitiesOnly yes<\/pre>\n\u4fdd\u5b58\u9000\u5904\u5373\u53ef\u3002\u6ce8\u610f\uff0c\u7b2c\u4e00\u884c\u7684hotname\u662f\u4f60\u5bf9\u670d\u52a1\u5668\u8bbe\u7f6e\u7684\u522b\u540d\uff0c\u53eb\u4ec0\u4e48\u968f\u610f\u3002 \u7b2c\u4e8c\u884cserver-ip\u6362\u6210\u4f60\u7684\u8fdc\u7a0b\u670d\u52a1\u5668\u7684IP\u3002\u522b\u771f\u7684\u50bb\u4e4e\u4e4e\u7684\u7167\u642c\u590d\u5236\u4e86\u3002<\/div>\n
<\/div>\n
\u7136\u540e\u5c31\u53ef\u4ee5\u6267\u884c \u201cssh hostname\u201d\u547d\u4ee4(hostname\u6362\u6210\u4f60\u8bbe\u7f6e\u7684\u522b\u540d)\u6109\u5feb\u7684\u767b\u9646\u8fdb\u8fdc\u7a0b\u670d\u52a1\u5668\u4e86\u3002<\/div>\n
<\/div>\n
\u5982\u679c\u62a5\u9519\u201cBad owner or permissions on \/home\/root\/.ssh\/config\u201d\u5b57\u6837\uff0c\u90a3\u662f\u6743\u9650\u7684\u95ee\u9898\u3002<\/div>\n
\u5bf9config\u6587\u4ef6\u6267\u884c<\/p>\n
chmod 600 config<\/pre>\n<\/div>\nscp\u7684\u62f7\u8d1d\u547d\u4ee4\u3002\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\uff0cscp\u662flinux\u7cfb\u7edf\u4e0b\u57fa\u4e8essh\u767b\u9646\u8fdb\u884c\u5b89\u5168\u7684\u8fdc\u7a0b\u6587\u4ef6\u62f7\u8d1d\u547d\u4ee4\u3002\u5f53\u914d\u7f6e\u597dssh\u516c\u94a5\u548c\u522b\u540d\uff0c\u5728scp\u4e0a\u4e5f\u4e00\u6837\u901a\u7528<\/div>\n
\u672c\u6587\u539f\u521b\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/ssh-sumup.html<\/a><\/p>\n\u4f5c\u8005\uff1a\u502a\u5bb6\u5174\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"\u5bfc\u8bfb \u56e0\u4e3a\u4f7f\u7528\u73af\u5883\u5b8c\u5168\u5207\u6362\u5230\u4e86Fedora\u4e0b\uff0cFedora\u53ef\u6ca1\u6709Windows\u4e0bXshell\u90a3\u4e48\u989d\u5916\u7684ssh\u8fde […]<\/p>\n","protected":false},"author":362,"featured_media":113330,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-112311","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/112311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=112311"}],"version-history":[{"count":10,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/112311\/revisions"}],"predecessor-version":[{"id":113947,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/112311\/revisions\/113947"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/113330"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=112311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=112311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=112311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}