{"id":1362,"date":"2023-03-19T10:20:22","date_gmt":"2023-03-19T02:20:22","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1362"},"modified":"2023-04-28T21:18:37","modified_gmt":"2023-04-28T13:18:37","slug":"ssh-carries-password-to-log-in-sshpass","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/19\/ssh-carries-password-to-log-in-sshpass\/","title":{"rendered":"SSH\u643a\u5e26\u5bc6\u7801\u767b\u5f55sshpass"},"content":{"rendered":"<p>sshpass: \u7528\u4e8e\u975e\u4ea4\u4e92\u7684ssh \u5bc6\u7801\u9a8c\u8bc1<\/p>\n<p>SSH\u767b\u9646\u4e0d\u80fd\u5728\u547d\u4ee4\u884c\u4e2d\u6307\u5b9a\u5bc6\u7801\uff0c\u4e5f\u4e0d\u80fd\u5728shell\u4e2d\u968f\u5904\u53ef\u89c1\u7684\u3002sshpass\u7684\u51fa\u73b0\uff0c\u89e3\u51b3\u4e86\u8fd9\u4e00\u95ee\u9898\u3002\u5b83\u5141\u8bb8\u4f60\u7528 -p \u53c2\u6570\u6307\u5b9a\u660e\u6587\u5bc6\u7801\uff0c\u7136\u540e\u76f4\u63a5\u767b\u5f55\u8fdc\u7a0b\u670d\u52a1\u5668\u3002\u5b83\u652f\u6301\u5bc6\u7801\u4ece\u547d\u4ee4\u884c\u3001\u6587\u4ef6\u3001\u73af\u5883\u53d8\u91cf\u4e2d\u8bfb\u53d6\u3002<\/p>\n<p><!-- more --><\/p>\n<p>\u5bf9\u4e8edebian\/ubuntu\u7cfb\u7edf\u6765\u8bf4\uff0c\u5b89\u88c5\u65b9\u5f0f\u5f88\u7b80\u5355\uff1a<\/p>\n<pre><code>sudo apt-get install sshpass<\/code><\/pre>\n<p>\u5bf9\u4e8e\u5176\u4ed6\u7cfb\u7edf\u6765\u8bf4\uff0c\u53ef\u4ee5\u901a\u8fc7\u7f16\u8bd1\u6e90\u7801\uff1a<\/p>\n<pre><code># wget http:\/\/sourceforge.net\/projects\/sshpass\/files\/sshpass\/1.06\/sshpass-1.06.tar.gz\n# tar -xzf sshpass-1.06.tar.gz\n# .\/configure\n# make\n# sudo make install<\/code><\/pre>\n<p>\u5373\u53ef\u901a\u8fc7<\/p>\n<pre><code>sshpass -p [passwd] ssh -p [port] root@192.168.x.x<\/code><\/pre>\n<p>\u767b\u5f55\u8fdc\u7a0b\u4e3b\u673a\uff0c\u6216\u8005\u901a\u8fc7<\/p>\n<pre><code>sshpass -p [passwd] ssh -p [port] root@192.168.x.x rm \/tmp\/*<\/code><\/pre>\n<p>\u6267\u884c\u8fdc\u7a0b\u64cd\u4f5c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>sshpass: \u7528\u4e8e\u975e\u4ea4\u4e92\u7684ssh \u5bc6\u7801\u9a8c\u8bc1 SSH\u767b\u9646\u4e0d\u80fd\u5728\u547d\u4ee4\u884c\u4e2d\u6307\u5b9a\u5bc6\u7801\uff0c\u4e5f\u4e0d\u80fd\u5728shell\u4e2d\u968f\u5904\u53ef\u89c1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[96],"class_list":["post-1362","post","type-post","status-publish","format-standard","hentry","category-devops-base","tag-ssh"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1362","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1362"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1362\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1362"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}