{"id":359,"date":"2021-08-16T13:57:36","date_gmt":"2021-08-16T05:57:36","guid":{"rendered":"http:\/\/chuyaoyuan.com\/?p=359"},"modified":"2021-08-16T14:30:22","modified_gmt":"2021-08-16T06:30:22","slug":"centos7-ftp%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%ae%89%e8%a3%85%e4%b8%8e%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/chuyaoyuan.com\/?p=359","title":{"rendered":"CentOS7 FTP\u670d\u52a1\u5668\u5b89\u88c5\u4e0e\u914d\u7f6e"},"content":{"rendered":"\n<ul><li>\u5b89\u88c5<\/li><\/ul>\n\n\n\n<p>yum install -y vsftpd<\/p>\n\n\n\n<ul><li>\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8<\/li><\/ul>\n\n\n\n<p>systemctl enable vsftpd.service<\/p>\n\n\n\n<ul><li>\u542f\u52a8<\/li><\/ul>\n\n\n\n<p>systemctl start vsftpd.service<\/p>\n\n\n\n<!--more-->\n\n\n\n<ul><li>\u505c\u6b62<\/li><\/ul>\n\n\n\n<p>systemctl stop vsftpd.service<\/p>\n\n\n\n<ul><li>\u67e5\u770b\u72b6\u6001<\/li><\/ul>\n\n\n\n<p>systemctl status vsftpd.service<\/p>\n\n\n\n<p>1\u3001\u521b\u5efaFTP\u8d26\u6237<br>useradd yaoyuan<br>passwd yaoyuan #(\u56de\u8f66)\u7ed9\u7528\u6237yaoyuan\u8bbe\u7f6e\u767b\u5f55\u5bc6\u7801<\/p>\n\n\n\n<p>2\u3001\u5728\/var\/www\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2aexample\u6587\u4ef6\u5939\uff1a<br>cd \/var\/www\/<br>mkdir example<br>3\u3001\u8bbe\u7f6eyaoyuan\u7528\u6237\u8bbf\u95ee\u7684\u76ee\u5f55\u4e3a\/var\/www\/example<br>usermod -d \/var\/www\/example yaoyuan<br>ps\uff1a\u5982\u679c\u4fee\u6539yaoyuan\u63d0\u793a\u6709\u76f8\u5173\u8fdb\u7a0b\u5728\u4f7f\u7528\u8fd9\u4e2a\u7528\u6237\uff0c\u5219\u5148\u6740\u6b7b\u8fd9\u4e9b\u8fdb\u7a0b\u540e\u518d\u4fee\u6539\uff1a<br>ps -u yaoyuan | awk \u2018{print $1}\u2019 | grep -vi pid | xargs kill -9<br>4\u3001\u67e5\u770b\u65b0\u521b\u5efa\u7684\u7528\u6237\u7684\u4fe1\u606f:<br>tail \/etc\/passwd<\/p>\n\n\n\n<p>5\u3001\u5207\u6362\u5230\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\uff0c\u4fee\u6539vsftpd.conf\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n\n\n\n<p>cd \/etc\/vsftpd<\/p>\n\n\n\n<p>vi&nbsp;vsftpd.conf<\/p>\n\n\n\n<p>\u8fdb\u5165\u914d\u7f6e\u6587\u4ef6\u4e4b\u540e\uff0c\u627e\u5230\u4ee5\u4e0b\u5185\u5bb9\uff0c\u53bb\u6389\u524d\u9762\u7684\u6ce8\u91ca\uff08#\uff09\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/www.idcspy.com\/wp-content\/uploads\/2019\/12\/ftpuse.png\" alt=\"centos7\u914d\u7f6eFTP\u7528\u6237\u6587\u4ef6\"\/><\/figure>\n\n\n\n<p>\u7b2c\u4e00\u884c\uff1achroot_local_user = NO<\/p>\n\n\n\n<p>\u7b2c\u4e8c\u884c\uff1achroot_list_enable = YES \/\/\u9650\u5236\u8bbf\u95ee\u81ea\u8eab\u76ee\u5f55<\/p>\n\n\n\n<p>\u7b2c\u56db\u884c\uff1auserlist_file=\/etc\/vsftpd\/user_list\uff08\u6ca1\u6709\u81ea\u5df1\u589e\u52a0\u8fd9\u4e00\u884c\uff09<\/p>\n\n\n\n<p>6\u3001\u5728user_list\u6587\u4ef6\u4e2d\u6dfb\u52a0yaoyuan\u7528\u6237\uff1a<\/p>\n\n\n\n<p>cd \/etc\/vsftpd<\/p>\n\n\n\n<p>vi user_list<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u8bbe\u7f6e\u597d\u4e4b\u540e\u91cd\u542f\uff1asystemctl restart vsftpd.service<\/p>\n\n\n\n<p>7\u3001\u8fd9\u65f6\u5019\u4f7f\u7528FlashFXP\u8f6f\u4ef6\uff0c\u7136\u540e\u8f93\u5165yaoyuan\u548c\u4f60\u8bbe\u7f6e\u5bc6\u7801\u767b\u5f55\uff0c\u767b\u5f55\u540e\u53ef\u4ee5\u53d1\u73b0\u80fd\u591f\u6d4f\u89c8\u6574\u4e2aLinux\u7cfb\u7edf\u6587\u4ef6\uff0c\u4f46\u662f\u65e0\u6cd5\u4e0a\u4f20\u548c\u4e0b\u8f7d\u3002<\/p>\n\n\n\n<p>\u4f7f\u7528ll\u67e5\u770b\u6743\u9650\u547d\u4ee4\uff0c\u53d1\u73b0example\u6587\u4ef6\u5939\u5c5e\u4e8eroot\u7528\u6237\uff0c\u6240\u4ee5\u66f4\u6539example\u6587\u4ef6\u5939\u7684\u6240\u5c5e\u7ec4\u548c\u7528\u6237\uff1a<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u66f4\u6539\u7528\u6237\u7ec4\uff1achown yaoyuan:yaoyuan example<\/p>\n\n\n\n<p>\u66f4\u6539\u6743\u9650\uff1achmod 775 example<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u6743\u9650\u503c\u7684\u89e3\u8bfb<\/strong><\/p>\n\n\n\n<p>r==&gt;\u53ef\u8bfb w==&gt;\u53ef\u5199 x==&gt;\u53ef\u6267\u884c<\/p>\n\n\n\n<p>r=4 w=2 x=1<\/p>\n\n\n\n<p>777 \u4ee3\u8868 rwxr-rwx-rwx \u6240\u6709\u7528\u6237\u90fd\u53ef\u8bfb\u53ef\u5199\u53ef\u6267\u884c\u3002<\/p>\n\n\n\n<p>8\u3001\u8bbe\u7f6e\u5b8c\u6bd5\u540e\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u5728\u5f53\u524d\u76ee\u5f55\u4e0a\u4f20\u548c\u4e0b\u8f7d\u6587\u4ef6\u4e86\uff0c\u5927\u529f\u544a\u6210\u3002<\/p>\n\n\n\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u4ee5\u4e0a\u8bbe\u7f6e\u5b8c\u6210\u540e\uff0cyaoyuan\u7528\u6237\u53ea\u5bf9example\u6587\u4ef6\u62e5\u6709\u6743\u9650\uff0c\u867d\u7136\u5bf9\u5176\u5b83\u76ee\u5f55\u6587\u4ef6\u6ca1\u6709\u7ba1\u7406\u6743\u9650\uff0c\u4f46\u5374\u53ef\u4ee5\u6d4f\u89c8\u5176\u5b83\u6587\u4ef6\u76ee\u5f55\u3002\u5982\u679c\u60f3\u7981\u6b62yaoyuan\u7528\u6237\u5bf9\u5176\u5b83\u6587\u4ef6\u76ee\u5f55\u62e5\u6709\u8bbf\u95ee\u6743\u9650\u7684\u8bdd\uff0c\u9700\u8981\u901a\u8fc7\u4ee5\u4e0b\u8bbe\u7f6e\u3002<\/p>\n\n\n\n<p>1\u3001\u6253\u5f00FTP\u914d\u7f6e\u6587\u4ef6\uff0c\u7f16\u8f91vsftpd.chroot_list\u6587\u4ef6\uff08\u4e3b\u673a\u4e0d\u540c\u6587\u4ef6\u540d\u4e5f\u8bb8\u6709\u5dee\u522b\uff09<\/p>\n\n\n\n<p>cd \/etc\/vsftpd<\/p>\n\n\n\n<p>vi vsftpd.chroot_list<\/p>\n\n\n\n<p>\u7136\u540e\u5c06yaoyuan\u7528\u6237\u6dfb\u52a0\u90fd\u91cc\u9762\u53bb\uff1a<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u8bf4\u660e\uff1a<\/strong>\u524d\u9762\u5df2\u7ecf\u8bbe\u7f6e\u4e86chroot_local_user = NO\uff0c\u8868\u793a\u6240\u6709\u7528\u6237\u4e0d\u88ab\u9650\u5b9a\u5728\u4e3b\u76ee\u5f55\u5185\uff0cchroot_list_enable=YES\u8868\u793a\u8981\u542f\u7528chroot_list_file\uff0c\u56e0\u4e3achroot_local_user = NO\uff0c\u6240\u4ee5\u9700\u8981\u6dfb\u52a0\u201c\u4f8b\u5916\u5217\u8868\u201d \u201c\u7684chroot_list_file\uff0c\u8fd9\u91cc\u5217\u51fa\u7684\u662f\u90a3\u4e9b\u2018\u4f1a\u88ab\u9650\u5236\u5728\u4e3b\u76ee\u5f55\u4e0b\u2019\u7684\u7528\u6237\u3002<\/p>\n\n\n\n<p>\u4fee\u6539\u5b8c\u6210\u4e4b\u540e\uff0c\u4e0d\u8981\u5fd8\u8bb0\u91cd\u542f\u7684vsFTPd\u670d\u52a1\u5668 \u8fd0\u884c\u547d\u4ee4\uff1avsftpd systemctl restart vsftpd<\/p>\n\n\n\n<p>\u8bbe\u7f6e\u5b8c\u6210\u4e4b\u540e\uff0c\u4f7f\u7528\u8be5\u7528\u6237\u767b\u5f55FTP\u65f6\u5f80\u5f80\u4f1a\u9047\u5230\u8fd9\u4e2a\u9519\u8bef\uff1a<\/p>\n\n\n\n<p>500 OOPS: vsftpd: refusing to run with writable root inside chroot ()<\/p>\n\n\n\n<p>\u5982\u679c\u51fa\u73b0\u8fd9\u79cd\u60c5\u51b5\u53ef\u4ee5\u5728vsftpd\u7684\u914d\u7f6e\u6587\u4ef6\uff08vsftpd.conf\uff09\u4e2d\u589e\u52a0\u4e0b\u5217\u4e00\u9879\uff1a<\/p>\n\n\n\n<p>allow_writeable_chroot=YES<\/p>\n\n\n\n<p>\u8bbe\u7f6e\u5b8c\u6210\u4e4b\u540e\u5c31\u4e0d\u4f1a\u51fa\u73b0\u4e0a\u8ff0\u95ee\u9898\uff0c\u8fd9\u6837yaoyuan\u7528\u6237\u5c31\u65e0\u6cd5\u8bbf\u95ee\u5176\u4ed6\u76ee\u5f55\u6587\u4ef6\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5 yum install -y vsftpd \u8bbe\u7f6e\u5f00\u673a\u542f\u52a8 systemctl enable vsftpd [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/chuyaoyuan.com\/index.php?rest_route=\/wp\/v2\/posts\/359"}],"collection":[{"href":"https:\/\/chuyaoyuan.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chuyaoyuan.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chuyaoyuan.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chuyaoyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=359"}],"version-history":[{"count":4,"href":"https:\/\/chuyaoyuan.com\/index.php?rest_route=\/wp\/v2\/posts\/359\/revisions"}],"predecessor-version":[{"id":368,"href":"https:\/\/chuyaoyuan.com\/index.php?rest_route=\/wp\/v2\/posts\/359\/revisions\/368"}],"wp:attachment":[{"href":"https:\/\/chuyaoyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chuyaoyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chuyaoyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}