{"id":3738,"date":"2019-01-15T18:57:32","date_gmt":"2019-01-15T10:57:32","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=3738"},"modified":"2019-01-15T18:57:32","modified_gmt":"2019-01-15T10:57:32","slug":"scp-%e5%91%bd%e4%bb%a4%e4%b8%ad%e5%8f%91%e7%8e%b0%e4%ba%86%e4%b8%80%e4%b8%aa%e9%9a%90%e8%97%8f%e4%ba%86-35-%e5%b9%b4%e7%9a%84%e6%bc%8f%e6%b4%9e","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=3738","title":{"rendered":"scp \u547d\u4ee4\u4e2d\u53d1\u73b0\u4e86\u4e00\u4e2a\u9690\u85cf\u4e86 35 \u5e74\u7684\u6f0f\u6d1e"},"content":{"rendered":"<p>\n\t\u5728 Hacker News \u4e0a\uff0c\u6700\u8fd1\u88ab\u516c\u5e03\u7684\u4e00\u4e2a scp \u547d\u4ee4\u6f0f\u6d1e\u4e0a\u4e86\u5934\u6761\u3002\u76ee\u524d\u8be5\u6f0f\u6d1e\u53ef\u80fd\u5f71\u54cd\u7740\u5927\u90e8\u5206\u7684\u8ba1\u7b97\u673a\uff0c\u5e76\u4e14\u9690\u85cf\u4e86 35 \u5e74\u624d\u88ab\u53d1\u73b0\uff01\n<\/p>\n<p>\n\t\u6700\u8fd1\u6709\u4eba\u5728\u901a\u8fc7 Java \u4f7f\u7528 JSch \u5e93\uff0c\u53d1\u73b0\u6267\u884c SCP \u547d\u4ee4\u7684\u7cfb\u7edf\u4e2d\u5b58\u5728\u4e00\u4e9b\u95ee\u9898\u3002\n<\/p>\n<pre class=\"brush:java;\">\r\n \/\/ exec &#039;scp -f rfile&#039; remotely\r\nString command = &quot;scp -f &quot; + from;\r\nChannel channel = session.openChannel(&quot;exec&quot;);\r\n((ChannelExec) channel).setCommand(command);\r\n\/\/ get I\/O streams for remote scp\r\nOutputStream out = channel.getOutputStream();\r\nInputStream in = channel.getInputStream();\r\nchannel.connect();<\/pre>\n<p>\n\t\u901a\u5e38\u6211\u4eec\u6267\u884c\u547d\u4ee4\uff0c\u53ef\u80fd\u7684\u64cd\u4f5c\u5982\u4e0b\uff1a\n<\/p>\n<pre class=\"brush:bash;\">\r\nscp -f \/xttblog\/user\/provided\/path<\/pre>\n<p>\n\t\u4f46\u662f\u7531\u4e8e scp \u6ca1\u6709\u5bf9\u8fd9\u4e2a\u8def\u5f84\u8fdb\u884c\u8f6c\u4e49\u6216\u9650\u5236\uff0c\u90a3\u4e48\u6211\u4eec\u4e5f\u53ef\u4ee5\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff1a\n<\/p>\n<pre class=\"brush:bash;\">\r\n# path = &#039;\/; touch \/tmp\/foo&#039;\r\nscp -f \/; touch \/tmp\/foo<\/pre>\n<p>\n\t\u8fd9\u6837\u4e00\u6765\uff0c\u5c31\u4f1a\u5148\u6267\u884c scp -f \u547d\u4ee4\uff0c\u7136\u540e\u518d\u6267\u884c touch \/tmp\/foo \u547d\u4ee4\u3002\n<\/p>\n<p>\n\t\u539f\u672c\u4f5c\u8005\u4ee5\u4e3a\u8fd9\u662f JSch \u5e93\u7684\u6f0f\u6d1e\uff0c\u6700\u540e\u5c31\u7ed9 JSch \u63d0\u4e86\u6f0f\u6d1e\u62a5\u544a\u3002\u6700\u7ec8 JSch \u53cd\u9988\u8bf4\u8fd9\u662f OpenSSH \u7684\u6f0f\u6d1e\uff0cOpenSSH \u7684 SCP \u547d\u4ee4\u548c Rsync \u4e5f\u5b58\u5728\u540c\u6837\u7684\u95ee\u9898\u3002\n<\/p>\n<p>\n\tOpenSSH \u7684\u7ef4\u62a4\u4eba\u5458\u53cd\u9988\u8bf4\uff1a\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\u4ee3\u7801\u89c4\u8303\u95ee\u9898\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1fz7grvrx6ij20fk05qaba.jpg\" style=\"width: 560px;height: 206px\" \/>\n<\/p>\n<p>\n\t\u7531\u6b64\u53ef\u89c1\uff0c\u8fd9\u53c8\u662f\u4e00\u4e2a\u89c4\u8303\u95ee\u9898\u3002\n<\/p>\n<p>\n\t\u9488\u5bf9\u8fd9\u4e2a scp \u7684\u6f0f\u6d1e\uff0c\u5efa\u8bae\u5927\u5bb6\u4f7f\u7528 STFP \u6216\u8005\u4f7f\u7528 rsync -s\u3002\n<\/p>\n<p>\n\t\u9488\u5bf9\u8fd9\u4e2a\u6f0f\u6d1e\uff0c\u6709\u4eba\u6574\u7406\u4e86\u4e00\u4e2a\u65f6\u95f4\u7ebf\uff01\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"SCP \u547d\u4ee4\u6f0f\u6d1e\u65f6\u95f4\u7ebf\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1fz7gum6zarj20ej0abq5c.jpg\" style=\"width: 523px;height: 371px\" \/>\n<\/p>\n<p>\n\t\u76ee\u524d\uff0c\u8be5\u6f0f\u6d1e\u5df2\u88ab\u4fee\u590d\uff0c\u5347\u7ea7\u53ef\u4ee5\u5230\u8fd9\u91cc\u4e0b\u8f7d\u8865\u4e01\uff1a<a href=\"https:\/\/github.com\/openssh\/openssh-portable\/commit\/6010c0303a422a9c5fa8860c061bf7105eb7f8b2\">https:\/\/github.com\/openssh\/openssh-portable\/commit\/6010c0303a422a9c5fa8860c061bf7105eb7f8b2<\/a>\u3002\n<\/p>\n<h2>\n\t\u53c2\u8003\u8d44\u6599<br \/>\n<\/h2>\n<ul>\n<li>\n\t\t<a href=\"http:\/\/www.cnnvd.org.cn\/web\/xxk\/ldxqById.tag?CNNVD=CNNVD-201901-347\" target=\"_blank\">http:\/\/www.cnnvd.org.cn\/web\/xxk\/ldxqById.tag?CNNVD=CNNVD-201901-347<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/github.com\/openssh\/openssh-portable\/commit\/6010c0303a422a9c5fa8860c061bf7105eb7f8b2\" target=\"_blank\">https:\/\/github.com\/openssh\/openssh-portable\/commit\/6010c0303a422a9c5fa8860c061bf7105eb7f8b2<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/sintonen.fi\/advisories\/scp-client-multiple-vulnerabilities.txt\" target=\"_blank\">https:\/\/sintonen.fi\/advisories\/scp-client-multiple-vulnerabilities.txt<\/a>\n\t<\/li>\n<\/ul>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=3738\">scp \u547d\u4ee4\u4e2d\u53d1\u73b0\u4e86\u4e00\u4e2a\u9690\u85cf\u4e86 35 \u5e74\u7684\u6f0f\u6d1e<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u5728 Hacker News \u4e0a\uff0c\u6700\u8fd1\u88ab\u516c\u5e03\u7684\u4e00\u4e2a scp \u547d\u4ee4\u6f0f\u6d1e\u4e0a\u4e86\u5934\u6761\u3002\u76ee\u524d\u8be5\u6f0f\u6d1e\u53ef\u80fd\u5f71\u54cd\u7740\u5927\u90e8\u5206\u7684\u8ba1\u7b97\u673a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[358,706,1894,354,355],"class_list":["post-3738","post","type-post","status-publish","format-standard","hentry","category-yyzt","tag-admin","tag-linux","tag-scp","tag-sql","tag-xss"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3738","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3738"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3738\/revisions"}],"predecessor-version":[{"id":3739,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3738\/revisions\/3739"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3738"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3738"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3738"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}