{"id":1843,"date":"2011-10-23T09:41:50","date_gmt":"2011-10-23T01:41:50","guid":{"rendered":"http:\/\/www.jpuyy.com\/blog\/?p=1843"},"modified":"2014-07-14T15:51:50","modified_gmt":"2014-07-14T07:51:50","slug":"vps-ssh-howto","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=1843","title":{"rendered":"\u8fde\u63a5vps\u4e0a\u7684ssh"},"content":{"rendered":"<p>\u521b\u5efa\u4e00\u4e2a\u6743\u9650\u6700\u4f4e\u7684\u7528\u6237<\/p>\n<pre>useradd -M -s \/bin\/false username<\/pre>\n<p>\u521b\u5efa\u8be5\u7528\u6237\u7684\u5bc6\u7801\uff1a<\/p>\n<pre>passwd username<\/pre>\n<ul>\n<li>\n<h4>windows\u4f7f\u7528MyenTunnel\uff0c\u8f93\u597d\u7528\u6237\u540d\uff0c\u5bc6\u7801\uff0cip\uff0c\u7aef\u53e3<\/h4>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<h4>linux\u4f7f\u7528ssh -N -D 7070 username@yourserver.com<\/h4>\n<\/li>\n<\/ul>\n<p>\u5728linux\u4e0b\u4f7f\u7528\u5bc6\u94a5\u8ba4\u8bc1\u53ef\u4ee5\u514d\u8f93\u5bc6\u7801\uff0c\u800c\u4e14\u53c2\u8003\u4f7f\u7528ssh_config\uff0c\u521b\u5efa\u5e76\u5728~\/.ssh\/config\u91cc\u5199\u5165\u4ee5\u4e0b\u5185\u5bb9\uff0c\u53c2\u8003\uff1a<a href=\"http:\/\/www.lainme.com\/doku.php\/blog\/2011\/01\/%E4%BD%BF%E7%94%A8ssh_config\">http:\/\/www.lainme.com\/doku.php\/blog\/2011\/01\/%E4%BD%BF%E7%94%A8ssh_config<\/a><\/p>\n<pre>jpuyy@ubuntu $ vim ~\/.ssh\/config\r\n Host vps\r\n User jpuyy\r\n Hostname jpuyy.com\r\n PreferredAuthentications publickey\r\n IdentityFile ~\/.ssh\/id_rsavps\r\n DynamicForward 7070<\/pre>\n<p>\u8fd9\u65f6\u5728shell\u4e0b\u4f7f\u7528<\/p>\n<pre>$ssh vps<\/pre>\n<p>\u66f4\u6709\u4e00\u6b65\u767b\u5929\u4e4b\u611f\u3002<\/p>\n<p>\u5176\u4ed6\u5de5\u5177<\/p>\n<h2>autossh\u53ef\u4ee5\u5728ssh\u65ad\u6389\u540e\u91cd\u8fde<\/h2>\n<p>sudo apt-get install autossh<\/p>\n<p>autossh -M 2000 -N -v \u00a0username@hostip<\/p>\n<h2>plink\u53ef\u4ee5\u76f4\u63a5\u6307\u5b9a\u5bc6\u7801<\/h2>\n<p>ssh\u9700\u8981\u624b\u52a8\u8f93\u5165\uff0c\u56e0\u4e3a\u628a\u5bc6\u7801\u8868\u73b0\u5728history\u4e2d\u76f8\u5f53\u6050\u6016<\/p>\n<p>sudo apt-get install putty-tools<\/p>\n<p>plink -N -v username@hostip -pw password<\/p>\n<h2>sshpass\u4e5f\u53ef\u4ee5\u6307\u5b9a\u5bc6\u7801<\/h2>\n<p>Description : Tool for non-interactively performing password authentication with<br \/>\n            : so called &#8220;interactive keyboard password authentication&#8221; of SSH.<br \/>\n            : Most users should use more secure public key authentication of SSH<br \/>\n            : instead.<br \/>\nyum install sshpass<\/p>\n<h2>mosh\u662f\u5728\u7f51\u7edc\u6bd4\u8f83\u6162\u7684\u65f6\u5019\u4f7f\u7528\uff0c\u5c24\u5176\u662f\u56fd\u5916\u7ebf\u8def<\/h2>\n<p><a href=\"http:\/\/mosh.mit.edu\/\">http:\/\/mosh.mit.edu\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u521b\u5efa\u4e00\u4e2a\u6743\u9650\u6700\u4f4e\u7684\u7528\u6237 useradd -M -s \/bin\/false username \u521b\u5efa\u8be5\u7528\u6237\u7684\u5bc6\u7801\uff1a passwd username windows\u4f7f\u7528MyenTunnel\uff0c\u8f93\u597d\u7528\u6237\u540d\uff0c\u5bc6\u7801\uff0cip\uff0c\u7aef\u53e3 linux\u4f7f\u7528ssh -N -D 7070 username@yourserver.com \u5728linux\u4e0b\u4f7f\u7528\u5bc6\u94a5\u8ba4\u8bc1\u53ef\u4ee5\u514d\u8f93\u5bc6\u7801\uff0c\u800c\u4e14\u53c2\u8003\u4f7f\u7528ssh_config\uff0c\u521b\u5efa\u5e76\u5728~\/.ssh\/config\u91cc\u5199\u5165\u4ee5\u4e0b\u5185\u5bb9\uff0c\u53c2\u8003\uff1ahttp:\/\/www.lainme.com\/doku.php\/blog\/2011\/01\/%E4%BD%BF%E7%94%A8ssh_config jpuyy@ubuntu $ vim ~\/.ssh\/config Host vps User jpuyy Hostname jpuyy.com PreferredAuthentications publickey IdentityFile ~\/.ssh\/id_rsavps DynamicForward 7070 \u8fd9\u65f6\u5728shell\u4e0b\u4f7f\u7528 $ssh vps \u66f4\u6709\u4e00\u6b65\u767b\u5929\u4e4b\u611f\u3002 \u5176\u4ed6\u5de5\u5177 autossh\u53ef\u4ee5\u5728ssh\u65ad\u6389\u540e\u91cd\u8fde sudo apt-get install autossh autossh -M 2000 -N -v \u00a0username@hostip plink\u53ef\u4ee5\u76f4\u63a5\u6307\u5b9a\u5bc6\u7801 ssh\u9700\u8981\u624b\u52a8\u8f93\u5165\uff0c\u56e0\u4e3a\u628a\u5bc6\u7801\u8868\u73b0\u5728history\u4e2d\u76f8\u5f53\u6050\u6016 sudo apt-get install putty-tools plink [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[72],"class_list":["post-1843","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux-tips"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/1843","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1843"}],"version-history":[{"count":16,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/1843\/revisions"}],"predecessor-version":[{"id":6466,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/1843\/revisions\/6466"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1843"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}