{"id":476,"date":"2018-03-20T18:07:47","date_gmt":"2018-03-20T10:07:47","guid":{"rendered":"https:\/\/blestic.com\/blog\/?p=476"},"modified":"2019-02-12T15:30:34","modified_gmt":"2019-02-12T07:30:34","slug":"ubuntu%e5%bc%80%e5%90%afssh%e5%b9%b6%e5%85%81%e8%ae%b8root%e7%99%bb%e5%bd%95","status":"publish","type":"post","link":"https:\/\/blestic.com\/blog\/archives\/476","title":{"rendered":"SSH\u8fde\u63a5VPS\u6559\u7a0b"},"content":{"rendered":"\n<h5 class=\"wp-block-heading\">\u5f00\u542fSSH\u670d\u52a1\u548croot\u767b\u9646<\/h5>\n\n\n\n<p>Linux\u7cfb\u7edf\u5b89\u88c5\u914d\u7f6e\u540e\uff0c\u60f3\u7528Putty\u6216Xshell\u8fdc\u7a0b\u767b\u5f55\uff0c\u9700\u8981\u5f00\u542fSSH\u670d\u52a1\u3002<br>\u5728noVNC \u8f93\u5165\uff1aps -e|grep ssh<br>\u770b\u8f93\u51fa\u7ed3\u679c\u662f\u5426\u6709sshd\uff0c\u6ca1\u6709\u5219\u9700\u8981\u5b89\u88c5SSH\u670d\u52a1\uff1a<br>sudo apt-get install ssh<br>\u542f\u52a8SSH\u670d\u52a1\uff1a<br>sudo \/etc\/init.d\/ssh start<\/p>\n\n\n\n<p>\u9ed8\u8ba4\u662f\u4e0d\u5141\u8bb8root\u8fdc\u7a0b\u767b\u5f55\u7684\uff0c\u53ef\u4ee5\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u5f00\u542f\uff1a<br>sudo vi \/etc\/ssh\/sshd_config<br>Insert \u627e\u5230 PermitRootLogin without-password <br>\u4fee\u6539\u4e3a\uff1aPermitRootLogin yes<br>\u9000\u51fa\uff0c\u4fdd\u5b58\uff1aEsc -&gt; :wq<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>\u91cd\u542fSSH\u670d\u52a1\uff1a<br>sudo \/etc\/init.d\/ssh restart<br>\u6216 service ssh restart<br>\u5373\u53ef\u901a\u8fc7Winscp\u6216Putty\u4f7f\u7528root\u6743\u9650\u8fdc\u7a0b\u767b\u5f55\u3002<br>\u4fee\u6539\u5bc6\u7801\u540e\u5c31\u542f\u7528root\u7528\u6237\u4e86\uff1a<br>sudo passwd root<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">\u52a0\u901fSSH\u767b\u9646<\/h5>\n\n\n\n<p>vi \/etc\/ssh\/sshd_config \u548c \/etc\/ssh\/ssh_config<\/p>\n\n\n\n<p>\u627e\u5230\u6216\u6dfb\u52a0 #UseDNS yes \u4fee\u6539\u6216\u6dfb\u52a0 UseDNS no<br>\u627e\u5230 #GSSAPIAuthentication yes \u4fee\u6539\u6216\u6dfb\u52a0 GSSAPIAuthentication no<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">\u4fee\u6539DNS<\/h5>\n\n\n\n<p>\u5982\u679c\u65e0\u6cd5\u8fdc\u7a0bwget\u6587\u4ef6\uff0c\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u53ea\u9700\u8981\u4fee\u6539VPS\u4e3b\u673a\u7684DNS\u3002<\/p>\n\n\n\n<p>CentOS:<br>vi \/etc\/sysconfig\/network-scripts\/ifcfg-eth0<br>\u5728\u6700\u540e\u4e24\u884c\u6dfb\u52a0\uff1a<br>DNS1=8.8.8.8<br>DNS2=8.8.4.4<\/p>\n\n\n\n<p>Debian:<br>vi \/etc\/dhcp\/dhclient.conf<br>\u5728\u6700\u540e\u4e00\u884c\u6dfb\u52a0\uff1a<br>prepend domain-name-servers 8.8.8.8, 8.8.4.4;<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">\u5176\u5b83Lunix\u547d\u4ee4<\/h5>\n\n\n\n<p>\u4fee\u6539\u5bc6\u7801 passwd root<\/p>\n\n\n\n<p>\u4fee\u6b63\u65f6\u533a<br>\nrm -rf \/etc\/localtime  <br>\nln -s \/usr\/share\/zoneinfo\/Asia\/Shanghai \/etc\/localtime<\/p>\n\n\n\n<p>\u4fee\u6539\u4e3b\u673a\u540d<br>\nhostnamectl set-hostname host.yourname.com<\/p>\n\n\n\n<p>\u4fdd\u6301SSH\u8fde\u63a5\u4e0d\u4e2d\u65ad<br>\ncd \/etc\/ssh<br>\nchmod 0644 *<br>\nchmod 0600 ssh_host_ecdsa_key   ssh_host_rsa_key<br>\ncd ~<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f00\u542fSSH\u670d\u52a1\u548croot\u767b\u9646 Linux\u7cfb\u7edf\u5b89\u88c5\u914d\u7f6e\u540e\uff0c\u60f3\u7528Putty\u6216Xshell\u8fdc\u7a0b\u767b\u5f55\uff0c\u9700\u8981\u5f00\u542fSSH\u670d\u52a1\u3002\u5728noVNC \u8f93\u5165\uff1aps -e|grep ssh\u770b\u8f93\u51fa\u7ed3\u679c\u662f\u5426\u6709sshd\uff0c\u6ca1\u6709\u5219\u9700\u8981\u5b89\u88c5SSH\u670d\u52a1\uff1asudo apt-get install ssh\u542f\u52a8SSH\u670d\u52a1\uff1asudo \/etc\/init.d\/ssh start \u9ed8\u8ba4\u662f\u4e0d\u5141\u8bb8root\u8fdc\u7a0b\u767b\u5f55\u7684\uff0c\u53ef\u4ee5\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u5f00\u542f\uff1asudo vi \/etc\/ssh\/sshd_configInsert \u627e\u5230 PermitRootLogin without-password \u4fee\u6539\u4e3a\uff1aPermitRootLogin yes\u9000\u51fa\uff0c\u4fdd\u5b58\uff1aEsc -&gt; :wq<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[9],"class_list":["post-476","post","type-post","status-publish","format-standard","hentry","category-tech","tag-vps"],"_links":{"self":[{"href":"https:\/\/blestic.com\/blog\/wp-json\/wp\/v2\/posts\/476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blestic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blestic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blestic.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blestic.com\/blog\/wp-json\/wp\/v2\/comments?post=476"}],"version-history":[{"count":0,"href":"https:\/\/blestic.com\/blog\/wp-json\/wp\/v2\/posts\/476\/revisions"}],"wp:attachment":[{"href":"https:\/\/blestic.com\/blog\/wp-json\/wp\/v2\/media?parent=476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blestic.com\/blog\/wp-json\/wp\/v2\/categories?post=476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blestic.com\/blog\/wp-json\/wp\/v2\/tags?post=476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}