{"id":107,"date":"2021-05-22T02:10:00","date_gmt":"2021-05-22T02:10:00","guid":{"rendered":"https:\/\/262235.xyz\/?p=107"},"modified":"2021-05-22T02:10:00","modified_gmt":"2021-05-22T02:10:00","slug":"107","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2021\/05\/22\/107\/","title":{"rendered":"\u4f7f\u7528Docker\u5efa\u7acbFTP\u670d\u52a1\u4e34\u65f6\u4e0a\u4f20\u6587\u4ef6"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2021\/05\/2735216803.jpg\" alt=\"\" title=\"\"><\/p>\n<p>FTP\uff08File Transfer Protocol\uff0c\u6587\u4ef6\u4f20\u8f93\u534f\u8bae\uff09 \u662f TCP\/IP \u534f\u8bae\u7ec4\u4e2d\u7684\u534f\u8bae\u4e4b\u4e00\u3002FTP\u534f\u8bae\u5305\u62ec\u4e24\u4e2a\u7ec4\u6210\u90e8\u5206\uff0c\u5176\u4e00\u4e3aFTP\u670d\u52a1\u5668\uff0c\u5176\u4e8c\u4e3aFTP\u5ba2\u6237\u7aef\u3002\u5176\u4e2dFTP\u670d\u52a1\u5668\u7528\u6765\u5b58\u50a8\u6587\u4ef6\uff0c\u7528\u6237\u53ef\u4ee5\u4f7f\u7528FTP\u5ba2\u6237\u7aef\u901a\u8fc7FTP\u534f\u8bae\u8bbf\u95ee\u4f4d\u4e8eFTP\u670d\u52a1\u5668\u4e0a\u7684\u8d44\u6e90\u3002\u5728\u5f00\u53d1\u7f51\u7ad9\u7684\u65f6\u5019\uff0c\u901a\u5e38\u5229\u7528FTP\u534f\u8bae\u628a\u7f51\u9875\u6216\u7a0b\u5e8f\u4f20\u5230Web\u670d\u52a1\u5668\u4e0a\u3002\u6b64\u5916\uff0c\u7531\u4e8eFTP\u4f20\u8f93\u6548\u7387\u975e\u5e38\u9ad8\uff0c\u5728\u7f51\u7edc\u4e0a\u4f20\u8f93\u5927\u7684\u6587\u4ef6\u65f6\uff0c\u4e00\u822c\u4e5f\u91c7\u7528\u8be5\u534f\u8bae\u3002<\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0bFTP\u534f\u8bae\u4f7f\u7528TCP\u7aef\u53e3\u4e2d\u7684 20\u548c21\u8fd9\u4e24\u4e2a\u7aef\u53e3\uff0c\u5176\u4e2d20\u7528\u4e8e\u4f20\u8f93\u6570\u636e\uff0c21\u7528\u4e8e\u4f20\u8f93\u63a7\u5236\u4fe1\u606f\u3002\u4f46\u662f\uff0c\u662f\u5426\u4f7f\u752820\u4f5c\u4e3a\u4f20\u8f93\u6570\u636e\u7684\u7aef\u53e3\u4e0eFTP\u4f7f\u7528\u7684\u4f20\u8f93\u6a21\u5f0f\u6709\u5173\uff0c\u5982\u679c\u91c7\u7528\u4e3b\u52a8\u6a21\u5f0f\uff0c\u90a3\u4e48\u6570\u636e\u4f20\u8f93\u7aef\u53e3\u5c31\u662f20\uff1b\u5982\u679c\u91c7\u7528\u88ab\u52a8\u6a21\u5f0f\uff0c\u5219\u5177\u4f53\u6700\u7ec8\u4f7f\u7528\u54ea\u4e2a\u7aef\u53e3\u8981\u670d\u52a1\u5668\u7aef\u548c\u5ba2\u6237\u7aef\u534f\u5546\u51b3\u5b9a\u3002<\/p>\n<h2>Docker \u5efa\u7acbFTP\u670d\u52a1\u5668 \u811a\u672c\u547d\u4ee4<\/h2>\n<pre><code>ftp_dir=\/tmp\/ftp\nftp_ip=$(curl ip.sb)\n\nmkdir -p ${ftp_dir}\n\ndocker run -d -v ${ftp_dir}:\/home\/vsftpd \\r\n    -p 20:20 -p 21:21 -p 47400-47470:47400-47470 \\r\n    -e FTP_USER=ftp2021 \\r\n    -e FTP_PASS=ftp2021 \\r\n    -e PASV_ADDRESS=${ftp_ip} \\r\n    --name ftp \\r\n    --restart=always bogem\/ftp\n<\/code><\/pre>\n<h3>Windows \u6587\u4ef6\u7ba1\u7406\u5668\u5730\u5740\u8f93\u5165FTP\u5730\u5740\u5c31\u53ef\u4ee5\u4e0a\u4f20\u548c\u4e0b\u8f7d\u4e86<\/h3>\n<pre><code>ftp:\/\/ftp2021:ftp2021@lyvba.com<\/code><\/pre>\n<h3>\u4f7f\u7528\u5b8c\u6210\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u505c\u6b62\u6216\u8005\u5220\u9664<\/h3>\n<pre><code># \u505c\u6b62 FTP \u5bb9\u5668\ndocker stop ftp\n\n# \u5220\u9664 FTP \u5bb9\u5668\ndocker rm -f ftp<\/code><\/pre>\n<h3>\u53d1\u73b0\u7684\u95ee\u9898:\u6302\u8f7d\u5df2\u6709\u76ee\u5f55\u4f1a\u6539\u53d8\u76ee\u5f55\u62e5\u6709\u8005\uff0c\u53ef\u4ee5\u4f7f\u7528chown\u6539\u56de\u6765<\/h3>\n<ul>\n<li>\n<p>\u5982\u56fe\uff0c\u6211\u628aftp\u76ee\u5f55\u6302\u8f7d\u5230web\u76ee\u5f55\uff0c\u5bfc\u81f4web\u4e0d\u6b63\u5e38\uff0c\u6539\u56de\u6765\u624d\u6b63\u5e38\uff0c\u6240\u4ee5\u63a8\u8350\u65b0\u5efa\u4e00\u4e2a\u76ee\u5f55\u4e34\u65f6\u6302\u8f7d<br \/><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2021\/05\/3730246792.png\" alt=\"chown.png\" title=\"chown.png\"><\/p>\n<pre><code>chown -R www-data:www-data   \/var\/www\/html\/<\/code><\/pre>\n<\/li>\n<li>\n<p>\u9ed8\u8ba4\u6302\u8f7d\u76ee\u5f55\u4f1a\u6709\u4e9bftp\u547d\u4ee4\u65e0\u6548\uff0c\u4fee\u6539\u6302\u8f7d\u70b9\u53ef\u4ee5\u89e3\u51b3<\/p>\n<pre><code>-v \/myftp\/upgrade:\/home\/vsftpd\/root\/upgrade<\/code><\/pre>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>FTP\uff08File Transfer Protocol\uff0c\u6587\u4ef6\u4f20\u8f93\u534f\u8bae\uff09 \u662f TCP\/IP \u534f\u8bae\u7ec4\u4e2d\u7684\u534f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[15],"class_list":["post-107","post","type-post","status-publish","format-standard","hentry","category-docker","category-default","tag-docker"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/comments?post=107"}],"version-history":[{"count":0,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/107\/revisions"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}