{"id":101000,"date":"2024-07-21T14:44:10","date_gmt":"2024-07-21T06:44:10","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=101000"},"modified":"2024-07-21T14:44:10","modified_gmt":"2024-07-21T06:44:10","slug":"ssh-sftp-scp","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ssh-sftp-scp.html","title":{"rendered":"linux ssh\u3001sftp\u3001scp\u547d\u4ee4\u8fdc\u7a0b\u4f20\u8f93\u6587\u4ef6"},"content":{"rendered":"

\"\"<\/p>\n

\u4ee5\u4e0b\u5b9e\u9a8c\u6570\u636e\u90fd\u662f\u624b\u5de5\u4eb2\u6d4b\uff0c\u975e\u62f7\u8d1d\u800c\u6765\uff0c\u6240\u4ee5\u771f\u5b9e\u53ef\u9760\uff0c\u4e5f\u662f\u6211\u5728\u5de5\u4f5c\u5f53\u4e2d\u7ecf\u5e38\u7528\u5230\u7684\u4e00\u4e9b\u547d\u4ee4\uff0c\u5206\u4eab\u51fa\u6765\uff0c\u5927\u5bb6\u4e00\u5757\u5b66\u4e60\u3002\u7cfb\u7edf\u64cd\u4f5c\u73af\u5883Centos7.3 64 *2,\u4e24\u53f0\u673a\u5668\u90fd\u5728\u516c\u7f51IP\u5730\u5740\u5206\u522b\u662f<\/p>\n

\r\nA\uff1a223.5.5.5\r\n\r\nB\uff1a223.6.6.6\r\n<\/pre>\n
sftp\u662f\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u6587\u4ef6\u4f20\u8f93\u7a0b\u5f0f<\/strong><\/span><\/div>\n

\u5b83\u7c7b\u4f3c\u4e8eftp\u4f20\u8f93\u534f\u8bae\uff0c\u5c5e\u4e8essh, \u4f46\u5b83\u8fdb\u884c\u52a0\u5bc6\u4f20\u8f93\uff0c\u76f8\u5bf9FTP\u6765\u8bb2\u6709\u66f4\u9ad8\u7684\u5b89\u5168\u6027\u3002<\/p>\n

sftp\u7528\u6cd5<\/p>\n

\u5982\u679c\u6709\u670d\u52a1\u5668\u7684\u7aef\u53e3\u4e0d\u662f\u9ed8\u8ba4\u768422\uff0c\u8bf7\u5728sftp\u540e\u9762\u52a0-P \u7aef\u53e3\u53f7 \u5373\u53ef\u3002<\/p>\n

\r\n# sftp root@223.6.6.6\r\nThe authenticity of host \u2018223.6.6.6 (223.6.6.6)\u2019 can\u2019t be established.\r\nECDSA key fingerprint is SHA256:Hl\/dKTFzL4lOlF8DIG5itaV4OAsZunC2AWlFGLjLfsg.\r\nAre you sure you want to continue connecting (yes\/no)? yes\u3010\u8f93\u5165yes\u56de\u8f66\u3011\r\nWarning: Permanently added \u2018223.6.6.6\u2019 (ECDSA) to the list of known hosts.\r\nroot@223.6.6.6\u2019s password:\u3010\u8f93\u5165223.6.6.6\u7684root\u5bc6\u7801\u5e76\u56de\u8f66\u3011\r\nConnected to 223.6.6.6.\r\nsftp>\r\n<\/pre>\n

\u5c06223.6.6.6\u670d\u52a1\u5668\u6587\u4ef6\u4e0b\u8f7d\u5230223.5.5.5\u7684home\u76ee\u5f55;<\/p>\n

\r\nsftp> get \/var\/www\/renwole.txt \/home\/\r\n<\/pre>\n

\u5c06223.5.5.5\u670d\u52a1\u5668\u6587\u4ef6\u4e0a\u4f20\u5230223.6.6.6\u670d\u52a1\u5668\u7684mnt\u76ee\u5f55;<\/p>\n

\r\nsftp> put \/home\/renwole.txt \/mnt\/\r\n<\/pre>\n

\u4f60\u5982\u679c\u4e0d\u77e5\u9053\u8fdc\u7a0b\u4e3b\u673a\u7684\u76ee\u5f55\u662f\u4ec0\u4e48\u6837\uff0c ls\u547d\u4ee4\u53ef\u4ee5\u5217\u51fa223.6.6.6\u670d\u52a1\u5668\u7684\u5f53\u524d\u76ee\u5f55\u5217\u8868\u3002\u4f8b\u5982\uff1a<\/p>\n

\r\nsftp> ls \/\/\u548c\u67e5\u770b\u672c\u5730\u64cd\u4f5c\u547d\u4ee4\u4e00\u6837\r\nsftp> pwd \/\/\u67e5\u8be2223.6.6.6\u7684\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\r\n<\/pre>\n

\u6539\u53d8\u8def\u5f84\u53ef\u4ee5\u7528cd \uff0c\u6539\u53d8\u672c\u673a\u8def\u5f84\u53ef\u4ee5\u7528 cd.. \u4f8b\u5982;<\/p>\n

\r\nsftp> cd\r\n<\/pre>\n

\u5982\u679c\u7528\u4e8e\u4fee\u6539\u670d\u52a1\u5668\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528ssh\u8fde\u63a5\uff0c\u4f8b\u5982\uff1a<\/p>\n

\r\n# ssh root@223.6.6.6\r\nroot@223.6.6.6\u2019s password:\u3010\u8f93\u5165B\u670d\u52a1\u5668\u5bc6\u7801\u56de\u8f66\u8fdb\u5165\u5185\u90e8\u3011\r\n<\/pre>\n

\u5982\u679c\u60f3\u9000\u51fa\uff0c\u4f8b\u5982\uff1a<\/p>\n

\r\n# exit \/\/\u9000\u51fa\u673a\u5668\uff0c\u8fd4\u56de\u4f60\u539f\u59cb\u673a\u5668\u754c\u9762\u3002\r\n<\/pre>\n
scp\u5177\u6709\u548cssh\u4e00\u6837\u7684\u9a8c\u8bc1\u673a\u5236\uff0c\u4ece\u800c\u53ef\u4ee5\u5b9e\u73b02\u53f0\u673a\u5668\u5b89\u5168\u7684\u8fdc\u7a0b\u62f7\u8d1d\u6587\u4ef6<\/strong><\/span><\/div>\n

scp\u53ef\u4ee5\u6982\u62ec\u4e3a\uff1ascp -P \u7aef\u53e3 \u6587\u4ef6\u8def\u5f84 \u7528\u6237\u540d@\u4e3b\u673a\u5730\u5740:\u8fdc\u7a0b\u76ee\u5f55<\/p>\n

\u5982\u679c\u60f3\u62f7\u8d1d\u672c\u5730\u6587\u4ef6\u5230\u53e6\u5916\u4e00\u53f0ssh\u7ec8\u7aef\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1b<\/p>\n

\r\n# scp \/renwole\/mariadb.tar.gz root@223.6.6.6:\/renwole123\/\r\nroot@223.6.6.6\u2019s password:\u3010\u8f93\u5165\u5bc6\u7801\u56de\u8f66\u3011\r\nmariadb.tar.gz 8% 37MB 1.3MB\/s 05:29 ETA\r\n<\/pre>\n

\u5982\u679c\u4f60\u53cd\u8fc7\u6765\u64cd\u4f5c\uff0c\u628a\u8fdc\u7a0b\u4e3b\u673a\u7684\u6587\u4ef6\u62f7\u8d1d\u5230\u5f53\u524d\u7cfb\u7edf\uff0c\u64cd\u4f5c\u547d\u4ee4\u4ee5\u4e0b\uff1b<\/p>\n

\r\n# scp root@223.6.6.6:\/renwole123\/mariadb.tar.gz \/renwole\r\n<\/pre>\n

\u5982\u679c\u4f60\u60f3\u62f7\u8d1d\u6587\u4ef6\u5939\u4ee5\u53ca\u6587\u4ef6\u5939\u5185\u7684\u6240\u6709\u6587\u4ef6,\u5c31\u52a0\u53c2\u6570 -r \u5982\u679c\u4f60\u7684\u7aef\u53e3\u53f7\u4e0d\u662f22\uff0c\u90a3\u4e48\u9700\u8981\u5728scp\u540e\u52a0\u4e2a -P (\u533a\u5206\u5927\u5c0f\u5199)\u7aef\u53e3\u53f7\u3002\u5efa\u8bae\u52a0-C\u9009\u9879\uff0c\u56e0\u4e3a\u8fd9\u6837\u53ef\u4ee5\u542f\u7528SSH\u7684\u538b\u7f29\u529f\u80fd\uff1b\u4f20\u8f93\u901f\u5ea6\u66f4\u5feb\uff0c\u4f8b\u5982<\/p>\n

\r\n# scp -P 6632 -C \/renwole\/mariadb root@223.6.6.6:\/renwole123\/\r\n<\/pre>\n

\u5176\u5b9e\u6211\u4e2a\u4eba\u5efa\u8bae\u4f7f\u7528scp\uff0c\u901f\u5ea6\u5feb\uff0c\u7a33\u5b9a\uff0c\u5b89\u5168\u3002<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/renwole.com\/archives\/72<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/ssh-sftp-scp.html<\/a>\u7f16\u8f91\uff1a\u5434\u5411\u5e73\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u4ee5\u4e0b\u5b9e\u9a8c\u6570\u636e\u90fd\u662f\u624b\u5de5\u4eb2\u6d4b\uff0c\u975e\u62f7\u8d1d\u800c\u6765\uff0c\u6240\u4ee5\u771f\u5b9e\u53ef\u9760\uff0c\u4e5f\u662f\u6211\u5728\u5de5\u4f5c\u5f53\u4e2d\u7ecf\u5e38\u7528\u5230\u7684\u4e00\u4e9b\u547d\u4ee4\uff0c\u5206\u4eab\u51fa\u6765\uff0c\u5927\u5bb6\u4e00\u5757\u5b66\u4e60 […]<\/p>\n","protected":false},"author":668,"featured_media":101022,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-101000","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/101000","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/668"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=101000"}],"version-history":[{"count":12,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/101000\/revisions"}],"predecessor-version":[{"id":292345,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/101000\/revisions\/292345"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/101022"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=101000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=101000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=101000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}