{"id":299,"date":"2021-04-27T14:31:55","date_gmt":"2021-04-27T06:31:55","guid":{"rendered":"http:\/\/blog.xtaa.cn\/?p=299"},"modified":"2021-04-27T14:31:55","modified_gmt":"2021-04-27T06:31:55","slug":"299","status":"publish","type":"post","link":"http:\/\/blog.xtaa.cn\/index.php\/2021\/04\/27\/299\/","title":{"rendered":"Centos\u5f00ssh"},"content":{"rendered":"\n<p>\u5728\u865a\u62df\u673a\uff08Vmware Workstation\uff09\u4e0b\uff0c\u5b89\u88c5\u4e86CentOS7\uff0c\u73b0\u5728\u60f3\u901a\u8fc7SSH\u5de5\u5177\u8fde\u63a5\u865a\u62df\u673a\u4e2d\u7684CentOS7<\/p>\n\n\n\n<p>1\u3001 &nbsp;\u9996\u5148\uff0c\u8981\u786e\u4fddCentOS7\u5b89\u88c5\u4e86 &nbsp;openssh-server\uff0c\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165 &nbsp;yum list installed | grep openssh-server<\/p>\n\n\n\n<p>\u6b64\u5904\u663e\u793a\u5df2\u7ecf\u5b89\u88c5\u4e86 &nbsp;openssh-server\uff0c\u5982\u679c\u53c8\u6ca1\u4efb\u4f55\u8f93\u51fa\u663e\u793a\u8868\u793a\u6ca1\u6709\u5b89\u88c5 &nbsp;openssh-server\uff0c\u901a\u8fc7\u8f93\u5165 &nbsp;yum install openssh-server<\/p>\n\n\n\n<p>\u6765\u8fdb\u884c\u5b89\u88c5openssh-server<\/p>\n\n\n\n<p>2\u3001 &nbsp;\u627e\u5230\u4e86 &nbsp;\/etc\/ssh\/ &nbsp;\u76ee\u5f55\u4e0b\u7684sshd\u670d\u52a1\u914d\u7f6e\u6587\u4ef6&nbsp;sshd_config\uff0c\u7528Vim\u7f16\u8f91\u5668\u6253\u5f00<\/p>\n\n\n\n<p>\u5c06\u6587\u4ef6\u4e2d\uff0c\u5173\u4e8e\u76d1\u542c\u7aef\u53e3\u3001\u76d1\u542c\u5730\u5740\u524d\u7684 # \u53f7\u53bb\u9664<\/p>\n\n\n\n<p>\u7136\u540e\u5f00\u542f\u5141\u8bb8\u8fdc\u7a0b\u767b\u5f55<\/p>\n\n\n\n<p>\u6700\u540e\uff0c\u5f00\u542f\u4f7f\u7528\u7528\u6237\u540d\u5bc6\u7801\u6765\u4f5c\u4e3a\u8fde\u63a5\u9a8c\u8bc1<\/p>\n\n\n\n<p>\u4fdd\u5b58\u6587\u4ef6\uff0c\u9000\u51fa<\/p>\n\n\n\n<p>3\u3001 &nbsp;\u5f00\u542f &nbsp;sshd &nbsp;\u670d\u52a1\uff0c\u8f93\u5165&nbsp;sudo service sshd start<\/p>\n\n\n\n<p>\u68c0\u67e5 &nbsp;sshd &nbsp;\u670d\u52a1\u662f\u5426\u5df2\u7ecf\u5f00\u542f\uff0c\u8f93\u5165ps -e | grep sshd<\/p>\n\n\n\n<p>\u6216\u8005\u8f93\u5165netstat -an | grep 22 &nbsp;\u68c0\u67e5 &nbsp;22&nbsp;\u53f7\u7aef\u53e3\u662f\u5426\u5f00\u542f\u76d1\u542c<\/p>\n\n\n\n<p>4\u3001 &nbsp;\u5728Vmware Workstation\u4e2d\uff0c\u67e5\u770bCentOS7\u7684\u5c5e\u6027\uff0c\u53d1\u73b0\u7f51\u7edc\u8fde\u63a5\u65b9\u5f0f\u662f\u91c7\u7528\u7684 &nbsp;NAT&nbsp;&nbsp;\u65b9\u5f0f\u8fde\u63a5\u7684<\/p>\n\n\n\n<p>5\u3001 \u5728Vmware Workstation\u4e2d\uff0c\u70b9\u51fb\u7f16\u8f91=\u300b\u865a\u62df\u7f51\u7edc\u7f16\u8f91\u5668\uff0c\u8fdb\u5165\u865a\u62df\u7f51\u7edc\u7f16\u8f91\u5668\uff0c\u67e5\u770b\u53d1\u73b0 NAT \u6a21\u5f0f\u7684\u8fde\u63a5\u91c7\u7528\u7684\u7f51\u7edc\u9002\u914d\u5668\u540d\u79f0\u4e3aVMnet8<\/p>\n\n\n\n<p>6\u3001\u5728 windows \u4e3b\u673a\u4e2d\uff0c\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165ipconfig&nbsp;\u67e5\u770b\u4e3b\u673aIP\uff0c\u627e\u5230 VMnet8 \u7684\u8fde\u63a5\u4fe1\u606f\uff0c\u6b64\u5904 ip \u4e3a192.168.30.1<\/p>\n\n\n\n<p>7\u3001\u5728CentOS\u4e2d\uff0c\u8f93\u5165ifconfig\u67e5\u770b\u7f51\u7edc\u8fde\u63a5\u5730\u5740\uff0c\u53d1\u73b0CentOS\u7684\u7f51\u7edc\u5730\u5740\u4e3a192.168.112.128<\/p>\n\n\n\n<p>8\u3001\u5728CentOS\u4e2d\uff0c\u8f93\u5165ping 192.168.30.1&nbsp;\u6d4b\u8bd5\u662f\u5426\u80fd\u8fde\u901a\u4e3b\u673a\uff0c\u53d1\u73b0\u53ef\u4ee5\u8fde\u901a<\/p>\n\n\n\n<p>9\u3001\u5728\u4e3b\u673a\u4e2d\uff0c\u8f93\u5165&nbsp;ping 192.168.112.128\uff0c\u6d4b\u8bd5\u4e3b\u673a\u662f\u5426\u80fd\u8fde\u901aCentOS\uff0c\u53d1\u73b0\u8fde\u4e0d\u901a<\/p>\n\n\n\n<p>\u5982\u679c\u53ef\u4ee5\u8fde\u5f97\u901a\uff0c\u53ef\u4ee5\u76f4\u63a5\u8df3\u81f3\u7b2c12 \u6b65<\/p>\n\n\n\n<p>10\u3001\u5728\u4e3b\u673a\uff0c\u6253\u5f00\u7f51\u7edc\u914d\u7f6e\uff0c\u9009\u62e9\u7f51\u7edc\u9002\u914d\u5668 VMnet8 \u7684 &nbsp;TCP\/IPv4 &nbsp; \u7684\u5c5e\u6027\uff0c\u8fdb\u884c\u4e00\u4e0b\u7f51\u7edc\u914d\u7f6e<\/p>\n\n\n\n<p>\u8981\u6c42\u5b50\u7f51\u63a9\u7801\u3001\u9ed8\u8ba4\u7f51\u5173\u5747\u548cCentOS\u4e00\u81f4\uff0c\u5e76\u5c06IP\u5730\u5740\u4fee\u6539\u4e3a 192.168.112.1\uff0c\u5373\u4fdd\u8bc1\u4e3b\u673a\u7684 &nbsp;IP &nbsp;\u548c &nbsp;CentOS &nbsp;\u7684 &nbsp;IP &nbsp;\u5728\u540c\u4e00\u7f51\u7edc\u533a\u6bb5\u4e2d<\/p>\n\n\n\n<p>11\u3001\u518d\u5728\u4e3b\u673a\u4e2d\uff0c\u8f93\u5165&nbsp;ping 192.168.112.128\uff0c\u5df2\u7ecf\u53ef\u4ee5\u8fde\u63a5\u5f97\u901a\u4e86<\/p>\n\n\n\n<p>12\u3001\u5728SSH\u5de5\u5177\uff08\u6b64\u5904\u4f7f\u7528\u7684XShell\uff09\u4e2d\uff0c\u65b0\u5efa\u8fde\u63a5\uff0c\u8f93\u5165 &nbsp;CentOS &nbsp; \u7684 &nbsp;IP &nbsp;\u5730\u5740\u3001\u7528\u6237\u540d\u3001\u5bc6\u7801\u5373\u53ef\u8fde\u63a5\u6210\u529f<\/p>\n\n\n\n<p>\u8fde\u63a5\u6210\u529f<\/p>\n\n\n\n<p>13\u3001\u4e3a\u4e86\u514d\u53bb\u6bcf\u6b21\u5f00\u542f CentOS \u65f6\uff0c\u90fd\u8981\u624b\u52a8\u5f00\u542f &nbsp;sshd \u670d\u52a1\uff0c\u53ef\u4ee5\u5c06 sshd \u670d\u52a1\u6dfb\u52a0\u81f3\u81ea\u542f\u52a8\u5217\u8868\u4e2d\uff0c\u8f93\u5165systemctl enable sshd.service<\/p>\n\n\n\n<p>\u53ef\u4ee5\u901a\u8fc7\u8f93\u5165systemctl list-unit-files | grep sshd\uff0c\u67e5\u770b\u662f\u5426\u5f00\u542f\u4e86sshd \u670d\u52a1\u81ea\u542f\u52a8<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u865a\u62df\u673a\uff08Vmware Workstation\uff09\u4e0b\uff0c\u5b89\u88c5\u4e86CentOS7\uff0c\u73b0\u5728\u60f3\u901a\u8fc7SSH\u5de5\u5177\u8fde\u63a5\u865a\u62df\u673a\u4e2d\u7684C [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"class_list":["post-299","post","type-post","status-publish","format-standard","hentry","category-22"],"_links":{"self":[{"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/posts\/299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/comments?post=299"}],"version-history":[{"count":0,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/posts\/299\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/media?parent=299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/categories?post=299"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/tags?post=299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}