{"id":139,"date":"2019-09-06T10:19:46","date_gmt":"2019-09-06T02:19:46","guid":{"rendered":"http:\/\/iqotom.com\/?p=139"},"modified":"2019-09-09T10:16:49","modified_gmt":"2019-09-09T02:16:49","slug":"linux%e4%b8%8b%e6%90%ad%e5%bb%baftp%e6%9c%8d%e5%8a%a1%e5%99%a8ubuntu-18-04-1","status":"publish","type":"post","link":"http:\/\/iqotom.com\/?p=139","title":{"rendered":"Linux\u4e0b\u642d\u5efaFTP\u670d\u52a1\u5668(Ubuntu 18.04.1)"},"content":{"rendered":"\n<p> <strong>1.\u5b89\u88c5vsftpd\u8f6f\u4ef6\u5305 <\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install vsftpd<\/code><\/pre>\n\n\n\n<p> <strong>2.\u6253\u5f00\u914d\u7f6e\u6587\u4ef6 <\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/vsftpd.conf<\/code><\/pre>\n\n\n\n<p><strong>3.\u4fee\u6539\u53c2\u6570<\/strong><\/p>\n\n\n\n<p>\u4e00\u4e9b\u53c2\u6570\u53ef\u4ee5\u53bb\u6389\u6ce8\u91ca\u6fc0\u6d3b\uff0c\u4e3a\u4e86\u65b9\u4fbf\uff0c\u9ed8\u8ba4\u8bbe\u7f6e\u6211\u5168\u4e0d\u7ba1\uff0c\u7136\u540e\u6dfb\u52a0\u4e0b\u9762\u7684\u8bbe\u7f6e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u8fd9\u4e9b\u8bbe\u7f6e\u7cfb\u7edf\u9ed8\u8ba4\u662f\u5f00\u542f\u7684\uff0c\u53ef\u4ee5\u4e0d\u7ba1\nlisten=NO\nlisten_ipv6=YES\ndirmessage_enable=YES\nuse_localtime=YES\nxferlog_enable=YES\nconnect_from_port_20=YES\n\n#\u4e0b\u9762\u7684\u5c31\u8981\u81ea\u5b9a\u4e49\u8bbe\u7f6e\u4e86\uff0c\u5efa\u8bae\u7cfb\u7edf\u9ed8\u8ba4\u7684\u4e0d\u7ba1\uff0c\u7136\u540e\u590d\u5236\u4e0b\u9762\u7684\n\n#\u662f\u5426\u5141\u8bb8\u533f\u540d\u8bbf\u95ee\uff0cNO\u4e3a\u4e0d\u5141\u8bb8\nanonymous_enable=NO\n#\u662f\u5426\u5141\u8bb8\u672c\u5730\u7528\u6237\u8bbf\u95ee,\u5c31\u662flinux\u672c\u673a\u4e2d\u5b58\u5728\u7684\u7528\u6237\uff0cYES\u5141\u8bb8\nlocal_enable=YES\n#\u662f\u5426\u5f00\u542f\u5199\u6a21\u5f0f\uff0cYES\u4e3a\u5f00\u542f\nwrite_enable=YES\n#\u65b0\u5efa\u6587\u4ef6\u6743\u9650\uff0c\u4e00\u822c\u8bbe\u7f6e\u4e3a022\uff0c\u90a3\u4e48\u65b0\u5efa\u540e\u7684\u6587\u4ef6\u7684\u6743\u9650\u5c31\u662f777-022=755\nlocal_umask=022\n\n#\u662f\u5426\u542f\u52a8userlist\u4e3a\u901a\u8fc7\u6a21\u5f0f\uff0cYES\u7684\u8bdd\u53ea\u6709\u5b58\u5728\u4e8euserlist\u6587\u4ef6\u4e2d\u7684\u7528\u6237\u624d\u80fd\u767b\u5f55ftp\uff08\u53ef\u4ee5\u7406\u89e3\u4e3auserlist\u662f\u4e00\u4e2a\u767d\u540d\u5355\uff09\uff0cNO\u7684\u8bdd\uff0c\u767d\u540d\u5355\u5931\u6548\uff0c\u548c\u4e0b\u9762\u4e00\u4e2a\u53c2\u6570\u914d\u5408\u4f7f\u7528\nuserlist_enable=YES\n#\u662f\u5426\u542f\u52a8userlist\u4e3a\u7981\u6b62\u6a21\u5f0f\uff0cYES\u8868\u793a\u5728userlist\u4e2d\u7684\u7528\u6237\u7981\u6b62\u767b\u5f55ftp\uff08\u9ed1\u540d\u5355\uff09\uff0cNO\u8868\u793a\u9ed1\u540d\u5355\u5931\u6548\uff0c\u6211\u4eec\u5df2\u7ecf\u8ba9userlist\u4f5c\u4e3a\u4e00\u4e2a\u767d\u540d\u5355\uff0c\u6240\u4ee5\u65e0\u9700\u4f7f\u7528\u9ed1\u540d\u5355\u529f\u80fd\nuserlist_deny=NO\n#\u6307\u5b9a\u54ea\u4e2a\u6587\u4ef6\u4f5c\u4e3auserlist\u6587\u4ef6\uff0c\u6211\u4eec\u7a0d\u540e\u7f16\u8f91\u8fd9\u4e2a\u6587\u4ef6\nuserlist_file=\/etc\/vsftpd.user_list\n\n#\u662f\u5426\u9650\u5236\u672c\u5730\u6240\u6709\u7528\u6237\u5207\u6362\u6839\u76ee\u5f55\u7684\u6743\u9650\uff0cYES\u4e3a\u5f00\u542f\u9650\u5236\uff0c\u5373\u767b\u5f55\u540e\u7684\u7528\u6237\u4e0d\u80fd\u8bbf\u95eeftp\u6839\u76ee\u5f55\u4ee5\u5916\u7684\u76ee\u5f55\uff0c\u5f53\u7136\u8981\u9650\u5236\u5566\nchroot_local_user=YES\n#\u662f\u5426\u542f\u52a8\u9650\u5236\u7528\u6237\u7684\u540d\u5355list\u4e3a\u5141\u8bb8\u6a21\u5f0f\uff0c\u4e0a\u9762\u7684YES\u9650\u5236\u4e86\u6240\u6709\u7528\u6237\uff0c\u53ef\u4ee5\u7528\u8fd9\u4e2a\u540d\u5355\u4f5c\u4e3a\u767d\u540d\u5355\uff0c\u4f5c\u4e3a\u4f8b\u5916\u5141\u8bb8\u8bbf\u95eeftp\u6839\u76ee\u5f55\u4ee5\u5916\nchroot_list_enable=YES\n#\u8bbe\u7f6e\u54ea\u4e2a\u6587\u4ef6\u662flist\u6587\u4ef6\uff0c\u91cc\u9762\u7684\u7528\u6237\u5c06\u4e0d\u53d7\u9650\u5236\u7684\u53bb\u8bbf\u95eeftp\u6839\u76ee\u5f55\u4ee5\u5916\u7684\u76ee\u5f55\nchroot_list_file=\/etc\/vsftpd.chroot_list\n#\u662f\u5426\u5f00\u542f\u5199\u6a21\u5f0f\uff0c\u5f00\u542f\u540e\u53ef\u4ee5\u8fdb\u884c\u521b\u5efa\u6587\u4ef6\u5939\u7b49\u5199\u5165\u64cd\u4f5c\nallow_writeable_chroot=YES\n\n#\u8bbe\u7f6eftp\u6839\u76ee\u5f55\u7684\u4f4d\u7f6e,\u8fd9\u4e2a\u6587\u4ef6\u6211\u4eec\u7a0d\u540e\u81ea\u5df1\u521b\u5efa\nlocal_root=\/var\/myftp<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"645\" src=\"http:\/\/iqotom.com\/wp-content\/uploads\/2019\/09\/linux-ftp-vsftpd.conf_-1024x645.png\" alt=\"\" class=\"wp-image-141\" srcset=\"http:\/\/iqotom.com\/wp-content\/uploads\/2019\/09\/linux-ftp-vsftpd.conf_-1024x645.png 1024w, http:\/\/iqotom.com\/wp-content\/uploads\/2019\/09\/linux-ftp-vsftpd.conf_-300x189.png 300w, http:\/\/iqotom.com\/wp-content\/uploads\/2019\/09\/linux-ftp-vsftpd.conf_-768x484.png 768w, http:\/\/iqotom.com\/wp-content\/uploads\/2019\/09\/linux-ftp-vsftpd.conf_.png 1184w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p> \u91cd\u542fvsftpd <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/etc\/init.d\/vsftpd restart<\/code><\/pre>\n\n\n\n<p> <strong>4.\u6dfb\u52a0ftp\u7528\u6237 <\/strong><\/p>\n\n\n\n<p> \u987a\u4fbf\u5c06\u5c06\u7528\u6237\u76ee\u5f55\u8bbe\u7f6e\u4e3a\u6211\u4eec\u4e0a\u9762\u7684ftp\u6839\u76ee\u5f55 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo useradd -d \/var\/myftp xxxuser<\/code><\/pre>\n\n\n\n<p> \u8bbe\u7f6e\u7528\u6237\u5bc6\u7801 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo passwd xxxpwd<\/code><\/pre>\n\n\n\n<p> <strong>5.\u521b\u5efa\u9700\u8981\u7684\u6587\u4ef6\uff0c\u8bbe\u7f6e\u6587\u4ef6\u5939\u6743\u9650 <\/strong><\/p>\n\n\n\n<p> \u4e0a\u9762\u6211\u4eec\u6307\u5b9a\u4e86\u4e24\u4e2a\u6587\u4ef6\uff0cuserlist\u6587\u4ef6\u548clist\u6587\u4ef6\uff0c\u7cfb\u7edf\u4e0d\u4f1a\u81ea\u52a8\u521b\u5efa\uff0c\u4f60\u8981\u81ea\u5df1\u521b\u5efa <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/vsftpd.user_list<\/code><\/pre>\n\n\n\n<p> \u7136\u540e\u6dfb\u52a0ftpuser\u8fdb\u53bb\u4f5c\u4e3a\u767d\u540d\u5355\u7684\u4e00\u5458 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/vsftpd.chroot_list<\/code><\/pre>\n\n\n\n<p>\u8bbe\u4e3a\u7a7a\u5373\u53ef, \u521b\u5efa\u7528\u6237\u6587\u4ef6\u5939\uff0c\u8bbe\u7f6e\u6743\u9650 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir \/var\/myftp<\/code><\/pre>\n\n\n\n<p> \u6743\u9650\u8bbe\u7f6e\u53ef\u4ee5\u6839\u636e\u4f60\u7684\u4f7f\u7528\u573a\u666f\u6765\u8bbe\u7f6e\uff0c\u6211\u8fd9\u91cc\u5728\u6839\u76ee\u5f55\u4e0b\u7981\u6b62\u6b64\u7528\u6237\u5199\uff0c\u7136\u540e\u4e0b\u9762\u5efa\u4e24\u4e2a\u6587\u4ef6\u5939\uff0c\u4e00\u4e2adownload\u53ea\u5141\u8bb8\u8bfb\u53d6\uff0cupload\u5141\u8bb8\u5199\u548c\u8bfb <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod 555 \/var\/myftp\ncd \/var\/myftp\nmkdir upload\nchmod 755 upload\nmkdir download\nchmod 555 download<\/code><\/pre>\n\n\n\n<p> \u6700\u540e\u68c0\u67e5\u4e00\u4e0b\u6587\u4ef6\u6240\u6709\u8005\uff0c\u90fd\u6539\u4e3axxxuser\uff0c\u547d\u4ee4<code>chown xxxuser download\/upload<\/code><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"519\" height=\"129\" src=\"http:\/\/iqotom.com\/wp-content\/uploads\/2019\/09\/linux-ftp-myftp.png\" alt=\"\" class=\"wp-image-140\" srcset=\"http:\/\/iqotom.com\/wp-content\/uploads\/2019\/09\/linux-ftp-myftp.png 519w, http:\/\/iqotom.com\/wp-content\/uploads\/2019\/09\/linux-ftp-myftp-300x75.png 300w\" sizes=\"(max-width: 519px) 100vw, 519px\" \/><\/figure><\/div>\n\n\n\n<p><strong> 6.\u4f7f\u7528ftp\uff0c\u89e3\u51b3\u5404\u79cd\u95ee\u9898 <\/strong><\/p>\n\n\n\n<p> linux\u8bbf\u95ee\u8f93\u5165ftp \u52a0 \u4f60\u7684IP <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ftp xxx.xxx.xxx.xxx<\/code><\/pre>\n\n\n\n<p> \u8f93\u5165\u7528\u6237\u540dxxxuser\u548c\u5bc6\u7801 , \u5982\u679c\u767b\u5f55\u51fa\u73b0530\u9519\u8bef\uff1a <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/pam.d\/vsftpd<\/code><\/pre>\n\n\n\n<p>\u6ce8\u91ca\u6389#auth   required    pam_shells.so  <\/p>\n\n\n\n<p>\u7136\u540els\u4e00\u4e0b\uff0c\u5982\u679c\u5931\u8d25\u4e86\uff0c\u5207\u6362\u5230\u88ab\u52a8\u6a21\u5f0f\u5373\u53ef <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>passive mode<\/code><\/pre>\n\n\n\n<p>\n\n\u7136\u540emkdir\u4e00\u4e0b\u53d1\u73b0\u65e0\u6cd5\u521b\u5efa\u6587\u4ef6\u5939 550 create directory operation failed\n\n<\/p>\n\n\n\n<p>\n\n\u8f93\u5165\u4ee5\u4e0b\u6307\u4ee4\u5373\u53ef\n\n<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>setsebool -P ftpd_disable_trans on\n\/etc\/init.d\/vsftpd restart<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1.\u5b89\u88c5vsftpd\u8f6f\u4ef6\u5305 2.\u6253\u5f00\u914d\u7f6e\u6587\u4ef6 3.\u4fee\u6539\u53c2\u6570 \u4e00\u4e9b\u53c2\u6570\u53ef\u4ee5\u53bb\u6389\u6ce8\u91ca\u6fc0\u6d3b\uff0c\u4e3a\u4e86\u65b9\u4fbf\uff0c\u9ed8\u8ba4\u8bbe\u7f6e\u6211\u5168\u4e0d\u2026 <span class=\"read-more\"><a href=\"http:\/\/iqotom.com\/?p=139\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":143,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[17,7],"_links":{"self":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts\/139"}],"collection":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=139"}],"version-history":[{"count":1,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts\/139\/revisions"}],"predecessor-version":[{"id":142,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts\/139\/revisions\/142"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/media\/143"}],"wp:attachment":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=139"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}