{"id":94,"date":"2016-05-12T11:15:04","date_gmt":"2016-05-12T03:15:04","guid":{"rendered":"http:\/\/www.lnzdl.com\/blog\/?p=94"},"modified":"2016-05-12T11:15:04","modified_gmt":"2016-05-12T03:15:04","slug":"linux-ftp%e9%85%8d%e7%bd%ae%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"http:\/\/www.lnzdl.com\/blog\/linux-ftp%e9%85%8d%e7%bd%ae%e8%af%a6%e8%a7%a3\/","title":{"rendered":"linux FTP\u914d\u7f6e\u8be6\u89e3"},"content":{"rendered":"<p><b>\u4e00<\/b><b>.vsftpd<\/b><b>\u8bf4\u660e<\/b><b>:<\/b> <\/p>\n<p>LINUX\u4e0b\u5b9e\u73b0FTP\u670d\u52a1\u7684\u8f6f\u4ef6\u5f88\u591a,\u6700\u5e38\u89c1\u7684\u6709vsftpd,Wu-ftpd\u548cProftp\u7b49.Red Hat Enterprise Linux\u4e2d\u9ed8\u8ba4\u5b89\u88c5\u7684\u662fvsftpd. <\/p>\n<p>\u8bbf\u95eeFTP\u670d\u52a1\u5668\u65f6\u9700\u8981\u7ecf\u8fc7\u9a8c\u8bc1,\u53ea\u6709\u7ecf\u8fc7\u4e86FTP\u670d\u52a1\u5668\u7684\u76f8\u5173\u9a8c\u8bc1,\u7528\u6237\u624d\u80fd\u8bbf\u95ee\u548c\u4f20\u8f93\u6587\u4ef6.vsftpd\u63d0\u4f9b\u4e863\u79cdftp\u767b\u5f55\u5f62\u5f0f: <\/p>\n<p><b> (1)anonymous(<\/b><b>\u533f\u540d\u5e10\u53f7)<\/b> <\/p>\n<p>\u4f7f\u7528anonymous\u662f\u5e94\u7528\u5e7f\u6cdb\u7684\u4e00\u79cdFTP\u670d\u52a1\u5668.\u5982\u679c\u7528\u6237\u5728FTP\u670d\u52a1\u5668\u4e0a\u6ca1\u6709\u5e10\u53f7,\u90a3\u4e48\u7528\u6237\u53ef\u4ee5\u4ee5anonymous\u4e3a\u7528\u6237\u540d,\u4ee5\u81ea\u5df1\u7684\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u4e3a\u5bc6\u7801\u8fdb\u884c\u767b\u5f55.\u5f53\u533f\u540d\u7528\u6237\u767b\u5f55FTP\u670d\u52a1\u5668\u540e,\u5176\u767b\u5f55\u76ee\u5f55\u4e3a\u533f\u540dFTP\u670d\u52a1\u5668\u7684\u6839\u76ee\u5f55\/var\/ftp.\u4e3a\u4e86\u51cf\u8f7bFTP\u670d\u52a1\u5668\u7684\u8d1f\u8f7d,\u4e00\u822c\u60c5\u51b5\u4e0b,\u5e94\u5173\u95ed\u533f\u540d\u5e10\u53f7\u7684\u4e0a\u4f20\u529f\u80fd. <\/p>\n<p><b>&nbsp; (2)real(<\/b><b>\u771f\u5b9e\u5e10\u53f7)<\/b> <\/p>\n<p>real\u4e5f\u79f0\u4e3a\u672c\u5730\u5e10\u53f7,\u5c31\u662f\u4ee5\u771f\u5b9e\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u8fdb\u884c\u767b\u5f55,\u4f46\u524d\u63d0\u6761\u4ef6\u662f\u7528\u6237\u5728FTP\u670d\u52a1\u5668\u4e0a\u62e5\u6709\u81ea\u5df1\u7684\u5e10\u53f7.\u7528\u771f\u5b9e\u5e10\u53f7\u767b\u5f55\u540e,\u5176\u767b\u5f55\u7684\u76ee\u5f55\u4e3a\u7528\u6237\u81ea\u5df1\u7684\u76ee\u5f55,\u8be5\u76ee\u5f55\u5728\u7cfb\u7edf\u5efa\u7acb\u5e10\u53f7\u65f6\u7cfb\u7edf\u5c31\u81ea\u52a8\u521b\u5efa. <\/p>\n<p><b> (3)guest(<\/b><b>\u865a\u62df\u5e10\u53f7)<\/b> <\/p>\n<p>\u5982\u679c\u7528\u6237\u5728FTP\u670d\u52a1\u5668\u4e0a\u62e5\u6709\u5e10\u53f7,\u4f46\u6b64\u5e10\u53f7\u53ea\u80fd\u7528\u4e8e\u6587\u4ef6\u4f20\u8f93\u670d\u52a1,\u90a3\u4e48\u8be5\u5e10\u53f7\u5c31\u662fguest,guest\u662f\u771f\u5b9e\u5e10\u53f7\u7684\u4e00\u79cd\u5f62\u5f0f,\u5b83\u4eec\u7684\u4e0d\u540c\u4e4b\u5904\u5728\u4e8e,geust\u767b\u5f55FTP\u670d\u52a1\u5668\u540e,\u4e0d\u80fd\u8bbf\u95ee\u9664\u5bbf\u4e3b\u76ee\u5f55\u4ee5\u5916\u7684\u5185\u5bb9. <\/p>\n<p><b>\u4e8c<\/b><b>.FTP<\/b><b>\u76f8\u5173\u914d\u7f6e\u6587\u4ef6\u8bf4\u660e<\/b><b><\/b> <\/p>\n<p>\u5176\u76f8\u5173\u914d\u7f6e\u6587\u4ef6\u6709\/etc\/vsftpd\/vsftpd.conf,&nbsp; \/etc\/vsftpd.ftpusers,&nbsp; \/etc\/vsftpd.user_list,\u5728\u914d\u7f6eFTP\u670d\u52a1\u5668\u65f6,\u4e3b\u8981\u662f\u4fee\u6539\u8fd9\u4e9b\u6587\u4ef6\u4e2d\u7684\u76f8\u5173\u8bed\u53e5. <\/p>\n<p><b>1.vsftpd.conf<\/b><b>\u6587\u4ef6\u8bf4\u660e<\/b> <\/p>\n<p># Example config file \/etc\/vsftpd\/vsftpd.conf <\/p>\n<p># <\/p>\n<p># The default compiled in settings are fairly paranoid. This sample file <\/p>\n<p># loosens things up a bit, to make the ftp daemon more usable. <\/p>\n<p># Please see vsftpd.conf.5 for all compiled in defaults. <\/p>\n<p># <\/p>\n<p># READ THIS: This example file is NOT an exhaustive list of vsftpd options. <\/p>\n<p># Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd&#8217;s <\/p>\n<p># capabilities. <\/p>\n<p># <\/p>\n<p># Allow anonymous FTP? (Beware &#8211; allowed by default if you comment this out). <\/p>\n<p><b>anonymous_enable=YES <\/b> \/\/\u662f\u5426\u5141\u8bb8anonymous\u767b\u5f55FTP\u670d\u52a1\u5668,\u9ed8\u8ba4\u662f\u5141\u8bb8\u7684. <\/p>\n<p># <\/p>\n<p># Uncomment this to allow local users to log in. <\/p>\n<p><b>local_enable=YES<\/b> \/\/\u662f\u5426\u5141\u8bb8\u672c\u5730\u7528\u6237\u767b\u5f55FTP\u670d\u52a1\u5668,\u9ed8\u8ba4\u662f\u5141\u8bb8 <\/p>\n<p># <\/p>\n<p># Uncomment this to enable any form of FTP write command. <\/p>\n<p><b>write_enable=YES<\/b>&nbsp; \/\/\u662f\u5426\u5141\u8bb8\u7528\u6237\u5177\u6709\u5728FTP\u670d\u52a1\u5668\u6587\u4ef6\u4e2d\u6267\u884c\u5199\u7684\u6743\u9650,\u9ed8\u8ba4\u662f\u5141\u8bb8 <\/p>\n<p># <\/p>\n<p># Default umask for local users is 077. You may wish to change this to 022, <\/p>\n<p># if your users expect that (022 is used by most other ftpd&#8217;s) <\/p>\n<p>local_umask=022 \/\/\u8bbe\u7f6e\u672c\u5730\u7528\u6237\u7684\u6587\u4ef6\u751f\u6210\u63a9\u7801\u4e3a022,\u9ed8\u8ba4\u662f077 <\/p>\n<p># <\/p>\n<p># Uncomment this to allow the anonymous FTP user to upload files. This only <\/p>\n<p># has an effect if the above global write enable is activated. Also, you will <\/p>\n<p># obviously need to create a directory writable by the FTP user. <\/p>\n<p>#anon_upload_enable=YES <\/p>\n<p># <\/p>\n<p># Uncomment this if you want the anonymous FTP user to be able to create <\/p>\n<p># new directories. <\/p>\n<p>#anon_mkdir_write_enable=YES&nbsp; \/\/\u662f\u5426\u5141\u8bb8\u533f\u540d\u8d26\u6237\u5728FTP\u670d\u52a1\u5668\u4e2d\u521b\u5efa\u76ee\u5f55 <\/p>\n<p># <\/p>\n<p># Activate directory messages &#8211; messages given to remote users when they <\/p>\n<p># go into a certain directory. <\/p>\n<p>dirmessage_enable=YES \/\/\u6fc0\u6d3b\u76ee\u5f55\u4fe1\u606f,\u5f53\u8fdc\u7a0b\u7528\u6237\u66f4\u6539\u76ee\u5f55\u65f6,\u5c06\u51fa\u73b0\u63d0\u793a\u4fe1\u606f <\/p>\n<p># <\/p>\n<p># Activate logging of uploads\/downloads. <\/p>\n<p>xferlog_enable=YES&nbsp; \/\/\u542f\u7528\u4e0a\u4f20\u548c\u4e0b\u8f7d\u65e5\u5fd7\u529f\u80fd <\/p>\n<p># <\/p>\n<p># Make sure PORT transfer connections originate from port 20 (ftp-data). <\/p>\n<p>connect_from_port_20=YES&nbsp;&nbsp; \/\/\u542f\u7528FTP\u6570\u636e\u7aef\u53e3\u7684\u8fde\u63a5\u8bf7\u6c42 <\/p>\n<p># <\/p>\n<p># If you want, you can arrange for uploaded anonymous files to be owned by <\/p>\n<p># a different user. Note! Using &#8220;root&#8221; for uploaded files is not <\/p>\n<p># recommended! <\/p>\n<p>#chown_uploads=YES <\/p>\n<p>#chown_username=whoever <\/p>\n<p># <\/p>\n<p># You may override where the log file goes if you like. The default is shown <\/p>\n<p># below. <\/p>\n<p>#xferlog_file=\/var\/log\/vsftpd.log&nbsp; \/\/\u8bbe\u7f6e\u65e5\u5fd7\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u548c\u5b58\u50a8\u8def\u5f84,\u8fd9\u662f\u9ed8\u8ba4\u7684 <\/p>\n<p># <\/p>\n<p># If you want, you can have your log file in standard ftpd xferlog format <\/p>\n<p>xferlog_std_format=YES\/\/\u662f\u5426\u4f7f\u7528\u6807\u51c6\u7684ftpd xferlog\u65e5\u5fd7\u6587\u4ef6\u683c\u5f0f <\/p>\n<p># <\/p>\n<p># You may change the default value for timing out an idle session. <\/p>\n<p>#idle_session_timeout=600&nbsp; \/\/\u8bbe\u7f6e\u7a7a\u95f2\u7684\u7528\u6237\u4f1a\u8bdd\u4e2d\u65ad\u65f6\u95f4,\u9ed8\u8ba4\u662f10\u5206\u949f <\/p>\n<p># <\/p>\n<p># You may change the default value for timing out a data connection. <\/p>\n<p>#data_connection_timeout=120\/\/\u8bbe\u7f6e\u6570\u636e\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4,\u9ed8\u8ba4\u662f120\u79d2. <\/p>\n<p># <\/p>\n<p># It is recommended that you define on your system a unique user which the <\/p>\n<p># ftp server can use as a totally isolated and unprivileged user. <\/p>\n<p>#nopriv_user=ftpsecure <\/p>\n<p># <\/p>\n<p># Enable this and the server will recognise asynchronous ABOR requests. Not <\/p>\n<p># recommended for security (the code is non-trivial). Not enabling it, <\/p>\n<p># however, may confuse older FTP clients. <\/p>\n<p>#async_abor_enable=YES <\/p>\n<p># <\/p>\n<p># By default the server will pretend to allow ASCII mode but in fact ignore <\/p>\n<p># the request. Turn on the below options to have the server actually do ASCII <\/p>\n<p># mangling on files when in ASCII mode. <\/p>\n<p># Beware that turning on ascii_download_enable enables malicious remote parties <\/p>\n<p># to consume your I\/O resources, by issuing the command &#8220;SIZE \/big\/file&#8221; in <\/p>\n<p># ASCII mode. <\/p>\n<p># These ASCII options are split into upload and download because you may wish <\/p>\n<p># to enable ASCII uploads (to prevent uploaded scripts etc. from breaking), <\/p>\n<p># without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be <\/p>\n<p># on the client anyway.. <\/p>\n<p>#ascii_upload_enable=YES <\/p>\n<p><b>#ascii_download_enable=YES <\/b>\/\/\u662f\u5426\u5141\u8bb8\u4f7f\u7528ASCII\u683c\u5f0f\u6765\u4e0a\u4f20\u548c\u4e0b\u8f7d\u6587\u4ef6 <\/p>\n<p># <\/p>\n<p># You may fully customise the login banner string: <\/p>\n<p>#ftpd_banner=Welcome to blah FTP service.\/\/\u5728FTP\u670d\u52a1\u5668\u4e2d\u8bbe\u7f6e\u6b22\u8fce\u767b\u5f55\u7684\u4fe1\u606f. <\/p>\n<p># <\/p>\n<p># You may specify a file of disallowed anonymous e-mail addresses. Apparently <\/p>\n<p># useful for combatting certain DoS attacks. <\/p>\n<p>#deny_email_enable=YES <\/p>\n<p># (default follows) <\/p>\n<p>#banned_email_file=\/etc\/vsftpd.banned_emails <\/p>\n<p># <\/p>\n<p># You may specify an explicit list of local users to chroot() to their home <\/p>\n<p># directory. If chroot_local_user is YES, then this list becomes a list of <\/p>\n<p># users to NOT chroot(). <\/p>\n<p><b>#chroot_list_enable=YES <\/b>\/\/\u5982\u679c\u5e0c\u671b\u7528\u6237\u767b\u5f55\u540e\u4e0d\u80fd\u5207\u6362\u5230\u81ea\u5df1\u76ee\u5f55\u4ee5\u5916\u7684\u5176\u5b83\u76ee\u5f55,\u9700\u8981\u8bbe\u7f6e\u8be5\u9879,\u5982\u679c\u8bbe\u7f6echroot_list_enable=YES,\u90a3\u4e48\u53ea\u5141\u8bb8\/etc\/vsftpd.chroot_list\u4e2d\u5217\u51fa\u7684\u7528\u6237\u5177\u6709\u8be5\u529f\u80fd.\u5982\u679c\u5e0c\u671b\u6240\u6709\u7684\u672c\u5730\u7528\u6237\u90fd\u6267\u884c\u8005chroot,\u53ef\u4ee5\u589e\u52a0\u4e00\u884c:<b>chroot_local_user=YES<\/b> <\/p>\n<p># (default follows) <\/p>\n<p>#chroot_list_file=\/etc\/vsftpd.chroot_list <\/p>\n<p># <\/p>\n<p># You may activate the &#8220;-R&#8221; option to the builtin ls. This is disabled by <\/p>\n<p># default to avoid remote users being able to cause excessive I\/O on large <\/p>\n<p># sites. However, some broken FTP clients such as &#8220;ncftp&#8221; and &#8220;mirror&#8221; assume <\/p>\n<p># the presence of the &#8220;-R&#8221; option, so there is a strong case for enabling it. <\/p>\n<p>#ls_recurse_enable=YES <\/p>\n<p>pam_service_name=vsftpd&nbsp; \/\/\u8bbe\u7f6ePAM\u8ba4\u8bc1\u670d\u52a1\u7684\u914d\u7f6e\u6587\u4ef6\u540d\u79f0,\u8be5\u6587\u4ef6\u5b58\u653e\u5728\/etc\/pam.d\/\u76ee\u5f55\u4e0b. <\/p>\n<p><b>userlist_enable=YES<\/b> \/\/\u7528\u6237\u5217\u8868\u4e2d\u7684\u7528\u6237\u662f\u5426\u5141\u8bb8\u767b\u5f55FTP\u670d\u52a1\u5668,\u9ed8\u8ba4\u662f\u4e0d\u5141\u8bb8 <\/p>\n<p>#enable for standalone mode <\/p>\n<p>listen=YES&nbsp; \/\/\u4f7fvsftpd \u5904\u4e8e\u72ec\u7acb\u542f\u52a8\u6a21\u5f0f <\/p>\n<p>tcp_wrappers=YES&nbsp; \/\/\u4f7f\u7528tcp_wrqppers\u4f5c\u4e3a\u4e3b\u673a\u8bbf\u95ee\u63a7\u5236\u65b9\u5f0f <\/p>\n<p><b>2.vsftpd.ftpusers<\/b><b>\u6587\u4ef6\u8bf4\u660e<\/b><b><\/b> <\/p>\n<p><b>\u8fd9\u4e2a\u6587\u4ef6\u662f\u7528\u6765\u8bb0\u5f55&#8221;<\/b><b>\u4e0d\u5141\u8bb8&#8221;<\/b><b>\u767b\u5f55\u5230FTP<\/b><b>\u670d\u52a1\u5668\u7684\u7528\u6237<\/b>,\u901a\u5e38\u662f\u4e00\u4e9b\u7cfb\u7edf\u9ed8\u8ba4\u7684\u7528\u6237. <\/p>\n<p>\u4e0b\u9762\u662f\u8be5\u6587\u4ef6\u4e2d\u9ed8\u8ba4\u7684\u4e0d\u5141\u8bb8\u767b\u5f55\u7684\u540d\u5355: <\/p>\n<p># Users that are not allowed to login via ftp <\/p>\n<p>root \/\/\u9ed8\u8ba4\u60c5\u51b5\u4e0b,root\u548c\u5b83\u4ee5\u4e0b\u7684\u7528\u6237\u662f\u4e0d\u5141\u8bb8\u767b\u5f55FTP\u670d\u52a1\u5668\u7684.\u53ef\u4ee5\u5c06\u4e0d\u5141\u8bb8\u767b\u5f55\u7684\u7528\u6237\u6dfb\u52a0\u5230\u8fd9\u91cc\u6765.\u4f46\u5207\u8bb0\u6bcf\u4e2a\u7528\u6237\u90fd\u8981\u5355\u72ec\u5360\u7528\u4e00\u884c. <\/p>\n<p>bin <\/p>\n<p>daemon <\/p>\n<p>adm <\/p>\n<p>lp <\/p>\n<p>sync <\/p>\n<p>shutdown <\/p>\n<p>halt <\/p>\n<p>mail <\/p>\n<p>news <\/p>\n<p>uucp <\/p>\n<p>operator <\/p>\n<p>games <\/p>\n<p>nobody <\/p>\n<p><b>3.vsftpd.user_list<\/b><b>\u6587\u4ef6\u8bf4\u660e<\/b><b><\/b> <\/p>\n<p><b>\u5176\u5b9e\u5b83\u7684\u5185\u5bb9\u8ddf\u4e0a\u9762\u90a3\u4e2a\u6587\u4ef6\u5185\u5bb9\u4e00\u6837,<\/b><b>\u53ea\u662f\u5728\u7cfb\u7edf\u5bf9\u6587\u4ef6vsftpd.conf <\/b><b>\u8fdb\u884c\u68c0\u6d4b\u65f6,<\/b><b>\u4f1a\u68c0\u6d4b\u5230&#8221;userlist_deny=YES&#8221;,<\/b><b>\u56e0\u6b64\u8fd9\u4e2a\u6587\u4ef6\u5fc5\u987b\u5b58\u5728.<\/b>\u4e0b\u9762\u662f\u8fd9\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9. <\/p>\n<p># vsftpd userlist <\/p>\n<p># If userlist_deny=NO, only allow users in this file <\/p>\n<p># If userlist_deny=YES (default), never allow users in this file, and <\/p>\n<p># do not even prompt for a password. <\/p>\n<p># Note that the default vsftpd pam config also checks \/etc\/vsftpd.ftpusers <\/p>\n<p># for users that are denied. <\/p>\n<p>root <\/p>\n<p>bin <\/p>\n<p>daemon <\/p>\n<p>adm <\/p>\n<p>lp <\/p>\n<p>sync <\/p>\n<p>shutdown <\/p>\n<p>halt <\/p>\n<p>mail <\/p>\n<p>news <\/p>\n<p>uucp <\/p>\n<p>operator <\/p>\n<p>games <\/p>\n<p>nobody<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00.vsftpd\u8bf4\u660e: LINUX\u4e0b\u5b9e\u73b0FTP\u670d\u52a1\u7684\u8f6f\u4ef6\u5f88\u591a,\u6700\u5e38\u89c1\u7684\u6709vsftpd,Wu-ftpd\u548cProftp\u7b49.Red Hat Enterprise Linux\u4e2d\u9ed8\u8ba4\u5b89\u88c5\u7684\u662fvsftpd. \u8bbf\u95eeFTP\u670d\u52a1\u5668\u65f6\u9700\u8981\u7ecf\u8fc7\u9a8c\u8bc1,\u53ea\u6709\u7ecf\u8fc7\u4e86FTP\u670d\u52a1\u5668\u7684\u76f8\u5173\u9a8c\u8bc1,\u7528\u6237\u624d\u80fd\u8bbf\u95ee\u548c\u4f20\u8f93\u6587\u4ef6.vsftpd\u63d0\u4f9b\u4e863\u79cdftp\u767b\u5f55\u5f62\u5f0f: (1)anonymous(\u533f\u540d\u5e10\u53f7) \u4f7f\u7528anonymous\u662f\u5e94\u7528\u5e7f\u6cdb\u7684\u4e00 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.lnzdl.com\/blog\/wp-json\/wp\/v2\/posts\/94"}],"collection":[{"href":"http:\/\/www.lnzdl.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.lnzdl.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.lnzdl.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.lnzdl.com\/blog\/wp-json\/wp\/v2\/comments?post=94"}],"version-history":[{"count":1,"href":"http:\/\/www.lnzdl.com\/blog\/wp-json\/wp\/v2\/posts\/94\/revisions"}],"predecessor-version":[{"id":95,"href":"http:\/\/www.lnzdl.com\/blog\/wp-json\/wp\/v2\/posts\/94\/revisions\/95"}],"wp:attachment":[{"href":"http:\/\/www.lnzdl.com\/blog\/wp-json\/wp\/v2\/media?parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.lnzdl.com\/blog\/wp-json\/wp\/v2\/categories?post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.lnzdl.com\/blog\/wp-json\/wp\/v2\/tags?post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}