{"id":51728,"date":"2024-12-03T17:21:53","date_gmt":"2024-12-03T09:21:53","guid":{"rendered":"https:\/\/fwq.ai\/blog\/51728\/"},"modified":"2024-12-03T17:21:53","modified_gmt":"2024-12-03T09:21:53","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8linux%e4%b8%8a%e8%ae%be%e7%bd%aessh%e5%88%ab%e5%90%8d%e7%99%bb%e5%bd%95%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/51728\/","title":{"rendered":"\u5982\u4f55\u5728Linux\u4e0a\u8bbe\u7f6eSSH\u522b\u540d\u767b\u5f55\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u5728Linux\u4e0a\u8bbe\u7f6eSSH\u522b\u540d\u767b\u5f55\uff1f<\/h1>\n<p>\u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e ~\/.ssh\/config \u6587\u4ef6\u6765\u7ed9\u670d\u52a1\u5668\u5206\u914d\u522b\u540d\uff0c\u65b9\u4fbf\u4f7f\u7528 SSH \u767b\u5f55\u3002\u8be5\u914d\u7f6e\u6587\u4ef6\u5141\u8bb8\u4e3a\u6bcf\u53f0\u670d\u52a1\u5668\u6307\u5b9a\u767b\u5f55\u4fe1\u606f\u548c\u9a8c\u8bc1\u65b9\u6cd5\uff0c\u5305\u62ec\u4e3b\u673a\u540d\u3001\u7aef\u53e3\u53f7\u3001\u7528\u6237\u540d\u3001\u516c\u94a5\u6587\u4ef6\u548c\u8eab\u4efd\u9a8c\u8bc1\u7c7b\u578b\u3002<\/p>\n<p>\u4e3a\u4e86\u65b9\u4fbf\u767b\u5f55\u670d\u52a1\u5668\uff0c\u6211\u4eec\u4e00\u822c\u4f7f\u7528putty\u3001securecrt\u7b49\u7b49\u5de5\u5177\u3002\u5728\u7ec8\u7aef\u5982\u4f55\u901a\u8fc7\u670d\u52a1\u5668\u522b\u540d\u6765\u8fdb\u884c\u767b\u5f55\u5462\uff1f<\/p>\n<p>\u53ef\u4ee5\u521b\u5efa~\/.ssh\/config \u6587\u4ef6\u5e76\u4e3a\u6bcf\u53f0\u670d\u52a1\u5668\u6307\u5b9a\u767b\u5f55\u4fe1\u606f\u548c\u9a8c\u8bc1\u65b9\u6cd5\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>$&nbsp;vim&nbsp;~\/.ssh\/config\n\nhost&nbsp;www\n&nbsp;&nbsp;hostname&nbsp;www.ttlsa.com\n&nbsp;&nbsp;port&nbsp;22\n&nbsp;&nbsp;user&nbsp;root\n&nbsp;&nbsp;identityfile&nbsp;~\/.ssh\/id_rsa.pub\n&nbsp;&nbsp;identitiesonly&nbsp;yes\n\nhost&nbsp;bbs\n&nbsp;&nbsp;hostname&nbsp;115.28.45.104\n&nbsp;&nbsp;user&nbsp;anotheruser\n&nbsp;&nbsp;pubkeyauthentication&nbsp;no<\/pre>\n<p>\u7136\u540e\u76f4\u63a5\u6307\u5b9a\u522b\u540d\u8fdb\u884c\u767b\u5f55<\/p>\n<p>shell<br \/>$ ssh www<br \/>1 $ ssh www<br \/>\u9009\u9879\u6ce8\u91ca\uff1a<\/p>\n<p>hostname \u6307\u5b9a\u767b\u5f55\u7684\u4e3b\u673a\u540d\u6216ip\u5730\u5740<br \/>port \u6307\u5b9a\u767b\u5f55\u7684\u7aef\u53e3\u53f7<br \/>user \u767b\u5f55\u7528\u6237\u540d<br \/>identityfile \u767b\u5f55\u7684\u516c\u94a5\u6587\u4ef6<br \/>identitiesonly \u53ea\u63a5\u53d7ssh key \u767b\u5f55<br \/>pubkeyauthentication<\/p>\n<p>\u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300a\u5982\u4f55\u5728Linux\u4e0a\u8bbe\u7f6eSSH\u522b\u540d\u767b\u5f55\uff1f\u300b\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5927\u5bb6\u90fd\u638c\u63e1\u4e86\u5427\uff01\u5982\u679c\u60f3\u8981\u7ee7\u7eed\u63d0\u5347\u81ea\u5df1\u7684\u80fd\u529b\uff0c\u90a3\u4e48\u5c31\u6765\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u5427\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u5728Linux\u4e0a\u8bbe\u7f6eSSH\u522b\u540d\u767b\u5f55\uff1f \u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e ~\/.ssh\/config \u6587\u4ef6\u6765\u7ed9\u670d\u52a1\u5668\u5206\u914d\u522b\u540d\uff0c\u65b9\u4fbf\u4f7f\u7528 SSH \u767b\u5f55\u3002\u8be5\u914d\u7f6e\u6587\u4ef6\u5141\u8bb8\u4e3a\u6bcf\u53f0\u670d\u52a1\u5668\u6307\u5b9a\u767b\u5f55\u4fe1\u606f\u548c\u9a8c\u8bc1\u65b9\u6cd5\uff0c\u5305\u62ec\u4e3b\u673a\u540d\u3001\u7aef\u53e3\u53f7\u3001\u7528\u6237\u540d\u3001\u516c\u94a5\u6587\u4ef6\u548c\u8eab\u4efd\u9a8c\u8bc1\u7c7b\u578b\u3002 \u4e3a\u4e86\u65b9\u4fbf\u767b\u5f55\u670d\u52a1\u5668\uff0c\u6211\u4eec\u4e00\u822c\u4f7f\u7528putty\u3001securecrt\u7b49\u7b49\u5de5\u5177\u3002\u5728\u7ec8\u7aef\u5982\u4f55\u901a\u8fc7\u670d\u52a1\u5668\u522b\u540d\u6765\u8fdb\u884c\u767b\u5f55\u5462\uff1f \u53ef\u4ee5\u521b\u5efa~\/.ssh\/config \u6587\u4ef6\u5e76\u4e3a\u6bcf\u53f0\u670d\u52a1\u5668\u6307\u5b9a\u767b\u5f55\u4fe1\u606f\u548c\u9a8c\u8bc1\u65b9\u6cd5\uff0c\u5982\u4e0b\u6240\u793a\uff1a $&nbsp;vim&nbsp;~\/.ssh\/config host&nbsp;www &nbsp;&nbsp;hostname&nbsp;www.ttlsa.com &nbsp;&nbsp;port&nbsp;22 &nbsp;&nbsp;user&nbsp;root &nbsp;&nbsp;identityfile&nbsp;~\/.ssh\/id_rsa.pub &nbsp;&nbsp;identitiesonly&nbsp;yes host&nbsp;bbs &nbsp;&nbsp;hostname&nbsp;115.28.45.104 &nbsp;&nbsp;user&nbsp;anotheruser &nbsp;&nbsp;pubkeyauthentication&nbsp;no \u7136\u540e\u76f4\u63a5\u6307\u5b9a\u522b\u540d\u8fdb\u884c\u767b\u5f55 shell$ ssh www1 $ ssh www\u9009\u9879\u6ce8\u91ca\uff1a hostname \u6307\u5b9a\u767b\u5f55\u7684\u4e3b\u673a\u540d\u6216ip\u5730\u5740port \u6307\u5b9a\u767b\u5f55\u7684\u7aef\u53e3\u53f7user \u767b\u5f55\u7528\u6237\u540didentityfile \u767b\u5f55\u7684\u516c\u94a5\u6587\u4ef6identitiesonly \u53ea\u63a5\u53d7ssh key \u767b\u5f55pubkeyauthentication \u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300a\u5982\u4f55\u5728Linux\u4e0a\u8bbe\u7f6eSSH\u522b\u540d\u767b\u5f55\uff1f\u300b\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5927\u5bb6\u90fd\u638c\u63e1\u4e86\u5427\uff01\u5982\u679c\u60f3\u8981\u7ee7\u7eed\u63d0\u5347\u81ea\u5df1\u7684\u80fd\u529b\uff0c\u90a3\u4e48\u5c31\u6765\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u5427\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-51728","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/51728","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=51728"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/51728\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=51728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=51728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=51728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}