{"id":181459,"date":"2021-03-02T20:54:25","date_gmt":"2021-03-02T12:54:25","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=181459"},"modified":"2022-03-16T13:59:44","modified_gmt":"2022-03-16T05:59:44","slug":"basic-learning-11","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/basic-learning-11.html","title":{"rendered":"\u7b2c11\u7ae0 \u4f7f\u7528Vsftpd\u670d\u52a1\u4f20\u8f93\u6587\u4ef6"},"content":{"rendered":"
\u672c\u7ae0\u5f00\u7bc7\u8bb2\u89e3\u4e86\u4ec0\u4e48\u662f\u6587\u4ef6\u4f20\u8f93\u534f\u8bae\uff08File Transfer Protocol\uff0cFTP\uff09\uff0c\u4ee5\u53ca\u5982\u4f55\u90e8\u7f72vsftpd\u670d\u52a1\u7a0b\u5e8f\uff0c\u7136\u540e\u6df1\u5ea6\u5256\u6790\u4e86vsftpd\u4e3b\u914d\u7f6e\u6587\u4ef6\u4e2d\u6700\u5e38\u7528\u7684\u53c2\u6570\u53ca\u5176\u4f5c\u7528\uff0c\u5e76\u5b8c\u6574\u6f14\u793a\u4e86vsftpd\u670d\u52a1\u7a0b\u5e8f3\u79cd\u8ba4\u8bc1\u6a21\u5f0f\uff08\u533f\u540d\u5f00\u653e\u6a21\u5f0f\u3001\u672c\u5730\u7528\u6237\u6a21\u5f0f\u3001\u865a\u62df\u7528\u6237\u6a21\u5f0f\uff09\u7684\u914d\u7f6e\u65b9\u6cd5\u3002\u672c\u7ae0\u8fd8\u6db5\u76d6\u4e86\u53ef\u63d2\u62d4\u8ba4\u8bc1\u6a21\u5757\uff08Pluggable Authentication Module\uff0cPAM\uff09\u7684\u539f\u7406\u3001\u4f5c\u7528\u4ee5\u53ca\u5b9e\u7528\u7684\u914d\u7f6e\u65b9\u6cd5\u3002<\/p>\n
\u8bfb\u8005\u53ef\u4ee5\u901a\u8fc7\u672c\u7ae0\u4ecb\u7ecd\u7684\u5b9e\u6218\u5185\u5bb9\u8fdb\u4e00\u6b65\u7ec3\u4e60SELinux\u670d\u52a1\u7684\u914d\u7f6e\u65b9\u6cd5\uff0c\u638c\u63e1\u7b80\u5355\u6587\u4ef6\u4f20\u8f93\u534f\u8bae\uff08Trivial File Transfer Protocol\uff0cTFTP\uff09\u7684\u7406\u8bba\u53ca\u914d\u7f6e\u65b9\u6cd5\uff0c\u4ee5\u53ca\u5b66\u4e60\u5218\u9044\u8001\u5e08\u5728\u670d\u52a1\u90e8\u7f72\u548c\u6392\u9519\u65b9\u9762\u7684\u7ecf\u9a8c\u6280\u5de7\uff0c\u4ee5\u4fbf\u7075\u6d3b\u5e94\u5bf9\u751f\u4ea7\u73af\u5883\u4e2d\u9047\u5230\u7684\u5404\u79cd\u95ee\u9898\u3002<\/p>\n
\u4e00\u822c\u6765\u8bb2\uff0c\u4eba\u4eec\u5c06\u8ba1\u7b97\u673a\u8054\u7f51\u7684\u9996\u8981\u76ee\u7684\u5c31\u662f\u83b7\u53d6\u8d44\u6599\uff0c\u800c\u6587\u4ef6\u4f20\u8f93\u662f\u4e00\u79cd\u975e\u5e38\u91cd\u8981\u7684\u83b7\u53d6\u8d44\u6599\u7684\u65b9\u5f0f\u3002\u4eca\u5929\u7684\u4e92\u8054\u7f51\u662f\u7531\u51e0\u5343\u4e07\u53f0\u4e2a\u4eba\u8ba1\u7b97\u673a\u3001\u5de5\u4f5c\u7ad9\u3001\u670d\u52a1\u5668\u3001\u5c0f\u578b\u673a\u3001\u5927\u578b\u673a\u3001\u5de8\u578b\u673a\u7b49\u5177\u6709\u4e0d\u540c\u578b\u53f7\u3001\u4e0d\u540c\u67b6\u6784\u7684\u7269\u7406\u8bbe\u5907\u5171\u540c\u7ec4\u6210\u7684\uff0c\u800c\u4e14\u5373\u4fbf\u662f\u4e2a\u4eba\u8ba1\u7b97\u673a\uff0c\u4e5f\u53ef\u80fd\u4f1a\u88c5\u6709Windows\u3001Linux\u3001UNIX\u3001macOS\u7b49\u4e0d\u540c\u7684\u64cd\u4f5c\u7cfb\u7edf\u3002\u4e3a\u4e86\u80fd\u591f\u5728\u5982\u6b64\u590d\u6742\u591a\u6837\u7684\u8bbe\u5907\u4e4b\u95f4\u89e3\u51b3\u6587\u4ef6\u4f20\u8f93\u7684\u95ee\u9898\uff0c\u6587\u4ef6\u4f20\u8f93\u534f\u8bae\uff08FTP\uff09\u5e94\u8fd0\u800c\u751f\u3002<\/p>\n
FTP\u662f\u4e00\u79cd\u5728\u4e92\u8054\u7f51\u4e2d\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u7684\u534f\u8bae\uff0c\u57fa\u4e8e\u5ba2\u6237\u7aef\/\u670d\u52a1\u5668\u6a21\u5f0f\uff0c\u9ed8\u8ba4\u4f7f\u752820\u300121\u53f7\u7aef\u53e3\uff0c\u5176\u4e2d\u7aef\u53e320\u7528\u4e8e\u8fdb\u884c\u6570\u636e\u4f20\u8f93\uff0c\u7aef\u53e321\u7528\u4e8e\u63a5\u53d7\u5ba2\u6237\u7aef\u53d1\u51fa\u7684\u76f8\u5173FTP\u547d\u4ee4<\/a>\u4e0e\u53c2\u6570\u3002FTP\u670d\u52a1\u5668\u666e\u904d\u90e8\u7f72\u4e8e\u5185\u7f51\u4e2d\uff0c\u5177\u6709\u5bb9\u6613\u642d\u5efa\u3001\u65b9\u4fbf\u7ba1\u7406\u7684\u7279\u70b9\u3002\u800c\u4e14\u6709\u4e9bFTP\u5ba2\u6237\u7aef\u5de5\u5177\u8fd8\u53ef\u4ee5\u652f\u6301\u6587\u4ef6\u7684\u591a\u70b9\u4e0b\u8f7d\u4ee5\u53ca\u65ad\u70b9\u7eed\u4f20\u6280\u672f\uff0c\u56e0\u6b64\u5f97\u5230\u4e86\u5e7f\u5927\u7528\u6237\u7684\u9752\u7750\u3002FTP\u7684\u4f20\u8f93\u62d3\u6251\u5982\u56fe11-1\u6240\u793a\u3002<\/p>\n <\/p>\n \u56fe11-1 \u00a0FTP\u534f\u8bae\u7684\u4f20\u8f93\u62d3\u6251<\/p>\n FTP\u670d\u52a1\u5668\u662f\u6309\u7167FTP\u534f\u8bae\u5728\u4e92\u8054\u7f51\u4e0a\u63d0\u4f9b\u6587\u4ef6\u5b58\u50a8\u548c\u8bbf\u95ee\u670d\u52a1\u7684\u4e3b\u673a\uff0cFTP\u5ba2\u6237\u7aef\u5219\u662f\u5411\u670d\u52a1\u5668\u53d1\u9001\u8fde\u63a5\u8bf7\u6c42\uff0c\u4ee5\u5efa\u7acb\u6570\u636e\u4f20\u8f93\u94fe\u8def\u7684\u4e3b\u673a\u3002FTP\u534f\u8bae\u6709\u4e0b\u9762\u4e24\u79cd\u5de5\u4f5c\u6a21\u5f0f\u3002<\/p>\n \u4e3b\u52a8\u6a21\u5f0f<\/strong>\uff1aFTP\u670d\u52a1\u5668\u4e3b\u52a8\u5411\u5ba2\u6237\u7aef\u53d1\u8d77\u8fde\u63a5\u8bf7\u6c42\u3002<\/p>\n \u88ab\u52a8\u6a21\u5f0f<\/strong>\uff1aFTP\u670d\u52a1\u5668\u7b49\u5f85\u5ba2\u6237\u7aef\u53d1\u8d77\u8fde\u63a5\u8bf7\u6c42\uff08\u9ed8\u8ba4\u5de5\u4f5c\u6a21\u5f0f\uff09\u3002<\/p><\/blockquote>\n \u7b2c8\u7ae0\u5728\u5b66\u4e60\u9632\u706b\u5899\u670d\u52a1\u914d\u7f6e\u65f6\u66fe\u7ecf\u8bb2\u8fc7\uff0c\u9632\u706b\u5899\u4e00\u822c\u662f\u7528\u4e8e\u8fc7\u6ee4\u4ece\u5916\u7f51\u8fdb\u5165\u5185\u7f51\u7684\u6d41\u91cf\uff0c\u56e0\u6b64\u6709\u4e9b\u65f6\u5019\u9700\u8981\u5c06FTP\u7684\u5de5\u4f5c\u6a21\u5f0f\u8bbe\u7f6e\u4e3a\u4e3b\u52a8\u6a21\u5f0f\uff0c\u624d\u53ef\u4ee5\u4f20\u8f93\u6570\u636e\u3002<\/p>\n \u7531\u4e8eFTP\u3001HTTP\u3001Telnet\u7b49\u534f\u8bae\u7684\u6570\u636e\u90fd\u662f\u4f7f\u7528\u660e\u6587\u8fdb\u884c\u4f20\u8f93\u7684\uff0c\u56e0\u6b64\u4ece\u8bbe\u8ba1\u4e0a\u5c31\u662f\u4e0d\u53ef\u9760\u7684\u3002\u4eba\u4eec\u4e3a\u4e86\u6ee1\u8db3\u4ee5\u5bc6\u6587\u65b9\u5f0f\u4f20\u8f93\u6587\u4ef6\u7684\u9700\u6c42\uff0c\u53d1\u660e\u4e86vsftpd\u670d\u52a1\u7a0b\u5e8f\u3002vsftpd\uff08very secure ftp daemon\uff0c\u975e\u5e38\u5b89\u5168\u7684FTP\u5b88\u62a4\u8fdb\u7a0b\uff09\u662f\u4e00\u6b3e\u8fd0\u884c\u5728Linux\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u7684FTP\u670d\u52a1\u7a0b\u5e8f\uff0c\u4e0d\u4ec5\u5b8c\u5168\u5f00\u6e90\u800c\u4e14\u514d\u8d39\u3002\u6b64\u5916\uff0c\u5b83\u8fd8\u5177\u6709\u5f88\u9ad8\u7684\u5b89\u5168\u6027\u3001\u4f20\u8f93\u901f\u5ea6\uff0c\u4ee5\u53ca\u652f\u6301\u865a\u62df\u7528\u6237\u9a8c\u8bc1\u7b49\u5176\u4ed6FTP\u670d\u52a1\u7a0b\u5e8f\u4e0d\u5177\u5907\u7684\u7279\u70b9\u3002\u5728\u4e0d\u5f71\u54cd\u4f7f\u7528\u7684\u524d\u63d0\u4e0b\uff0c\u7ba1\u7406\u8005\u53ef\u4ee5\u81ea\u884c\u51b3\u5b9a\u5ba2\u6237\u7aef\u662f\u91c7\u7528\u533f\u540d\u5f00\u653e\u3001\u672c\u5730\u7528\u6237\u8fd8\u662f\u865a\u62df\u7528\u6237\u7684\u9a8c\u8bc1\u65b9\u5f0f\u6765\u767b\u5f55vsftpd\u670d\u52a1\u5668\u3002\u8fd9\u6837\u5373\u4fbf\u9ed1\u5ba2\u62ff\u5230\u4e86\u865a\u62df\u7528\u6237\u7684\u8d26\u53f7\u5bc6\u7801\uff0c\u4e5f\u4e0d\u89c1\u5f97\u80fd\u6210\u529f\u767b\u5f55vsftpd\u670d\u52a1\u5668\u3002<\/p>\n \u5728\u914d\u7f6e\u59a5\u5f53\u8f6f\u4ef6\u4ed3\u5e93\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u5b89\u88c5vsftpd\u670d\u52a1\u7a0b\u5e8f\u4e86\u3002\u65e0\u8bba\u662f\u4f7f\u7528yum\u8fd8\u662fdnf\u547d\u4ee4<\/a>\u90fd\u53ef\u4ee5\u5b89\u88c5\uff0c\u8fd9\u91cc\u4f18\u5148\u9009\u62e9\u4f7f\u7528dnf\u547d\u4ee4\u3002<\/p>\n iptables\u9632\u706b\u5899\u7ba1\u7406\u5de5\u5177\u9ed8\u8ba4\u7981\u6b62\u4e86FTP\u534f\u8bae\u7684\u7aef\u53e3\u53f7\uff0c\u56e0\u6b64\u5728\u6b63\u5f0f\u914d\u7f6evsftpd\u670d\u52a1\u7a0b\u5e8f\u4e4b\u524d\uff0c\u4e3a\u4e86\u907f\u514d\u8fd9\u4e9b\u9ed8\u8ba4\u7684\u9632\u706b\u5899\u7b56\u7565\u201c\u6363\u4e71\u201d\uff0c\u8fd8\u9700\u8981\u6e05\u7a7aiptables\u9632\u706b\u5899\u7684\u9ed8\u8ba4\u7b56\u7565\uff0c\u5e76\u628a\u5f53\u524d\u5df2\u7ecf\u88ab\u6e05\u7406\u7684\u9632\u706b\u5899\u7b56\u7565\u72b6\u6001\u4fdd\u5b58\u4e0b\u6765\uff1a<\/p>\n \u7136\u540e\u518d\u628aFTP\u534f\u8bae\u6dfb\u52a0\u5230firewalld\u670d\u52a1\u7684\u5141\u8bb8\u5217\u8868\u4e2d\uff08\u524d\u671f\u51c6\u5907\u5de5\u4f5c\u4e00\u5b9a\u8981\u505a\u5145\u8db3\uff09\uff1a<\/p>\n vsftpd\u670d\u52a1\u7a0b\u5e8f\u7684\u4e3b\u914d\u7f6e\u6587\u4ef6\uff08\/etc\/vsftpd\/vsftpd.conf\uff09\u5185\u5bb9\u603b\u957f\u5ea6\u6709127\u884c\u4e4b\u591a\uff0c\u4f46\u5176\u4e2d\u5927\u591a\u6570\u53c2\u6570\u5728\u5f00\u5934\u90fd\u6dfb\u52a0\u4e86\u4e95\u53f7\uff08#\uff09\uff0c\u4ece\u800c\u6210\u4e3a\u6ce8\u91ca\u4fe1\u606f\uff0c\u5927\u5bb6\u6ca1\u6709\u5fc5\u8981\u5728\u6ce8\u91ca\u4fe1\u606f\u4e0a\u82b1\u8d39\u592a\u591a\u7684\u65f6\u95f4\u3002\u6211\u4eec\u53ef\u4ee5\u5728grep\u547d\u4ee4\u540e\u9762\u6dfb\u52a0-v\u53c2\u6570\uff0c\u8fc7\u6ee4\u5e76\u53cd\u9009\u51fa\u6ca1\u6709\u5305\u542b\u4e95\u53f7\uff08#\uff09\u7684\u53c2\u6570\u884c\uff08\u5373\u8fc7\u6ee4\u6389\u6240\u6709\u7684\u6ce8\u91ca\u4fe1\u606f\uff09\uff0c\u7136\u540e\u5c06\u8fc7\u6ee4\u540e\u7684\u53c2\u6570\u884c\u901a\u8fc7\u8f93\u51fa\u91cd\u5b9a\u5411\u7b26\u5199\u56de\u539f\u59cb\u7684\u4e3b\u914d\u7f6e\u6587\u4ef6\u4e2d\u3002\u8fd9\u6837\u64cd\u4f5c\u4e4b\u540e\uff0c\u5c31\u53ea\u5269\u4e0b12\u884c\u6709\u6548\u53c2\u6570\u4e86\uff0c\u9a6c\u4e0a\u5c31\u4e0d\u7d27\u5f20\u4e86\uff1a<\/p>\n \u886811-1\u4e2d\u7f57\u5217\u4e86vsftpd\u670d\u52a1\u7a0b\u5e8f\u4e3b\u914d\u7f6e\u6587\u4ef6\u4e2d\u5e38\u7528\u7684\u53c2\u6570\u4ee5\u53ca\u4f5c\u7528\u3002\u5f53\u524d\u5927\u5bb6\u53ea\u9700\u8981\u7b80\u5355\u4e86\u89e3\u5373\u53ef\uff0c\u5728\u540e\u7eed\u7684\u5b9e\u9a8c\u4e2d\u5c06\u6f14\u793a\u8fd9\u4e9b\u53c2\u6570\u7684\u7528\u6cd5\uff0c\u4ee5\u5e2e\u52a9\u5927\u5bb6\u719f\u6089\u5e76\u638c\u63e1\u3002<\/p>\n \u886811-1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 vsftpd\u670d\u52a1\u7a0b\u5e8f\u5e38\u7528\u7684\u53c2\u6570\u4ee5\u53ca\u4f5c\u7528<\/p>\n[root@linuxprobe ~]# dnf install vsftpd\r\nUpdating Subscription Management repositories.\r\nUnable to read consumer identity\r\nThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.\r\nAppStream 3.1 MB\/s | 3.2 kB 00:00 \r\nBaseOS 2.7 MB\/s | 2.7 kB 00:00 \r\nDependencies resolved.\r\n========================================================================================\r\n Package Arch Version Repository Size\r\n========================================================================================\r\nInstalling:\r\n vsftpd x86_64 3.0.3-28.el8 AppStream 180 k\r\n\r\nTransaction Summary\r\n========================================================================================\r\nInstall 1 Package\r\n\r\nTotal size: 180 k\r\nInstalled size: 356 k\r\nIs this ok [y\/N]: y<\/strong>\r\nDownloading Packages:\r\nRunning transaction check\r\nTransaction check succeeded.\r\nRunning transaction test\r\nTransaction test succeeded.\r\nRunning transaction\r\n Preparing : 1\/1 \r\n Installing : vsftpd-3.0.3-28.el8.x86_64 1\/1 \r\n Running scriptlet: vsftpd-3.0.3-28.el8.x86_64 1\/1 \r\n Verifying : vsftpd-3.0.3-28.el8.x86_64 1\/1 \r\nInstalled products updated.\r\n\r\nInstalled:\r\n vsftpd-3.0.3-28.el8.x86_64 \r\n\r\nComplete!\r\n<\/pre>\n
[root@linuxprobe ~]# iptables -F\r\n[root@linuxprobe ~]# iptables-save \r\n<\/pre>\n
[root@linuxprobe ~]# firewall-cmd --permanent --zone=public --add-service=ftp \r\nsuccess\r\n[root@linuxprobe ~]# firewall-cmd --reload \r\nsuccess<\/pre>\n
[root@linuxprobe ~]# mv \/etc\/vsftpd\/vsftpd.conf \/etc\/vsftpd\/vsftpd.conf_bak\r\n[root@linuxprobe ~]# grep -v \"#\" \/etc\/vsftpd\/vsftpd.conf_bak > \/etc\/vsftpd\/vsftpd.conf\r\n[root@linuxprobe ~]# cat \/etc\/vsftpd\/vsftpd.conf\r\nanonymous_enable=NO\r\nlocal_enable=YES\r\nwrite_enable=YES\r\nlocal_umask=022\r\ndirmessage_enable=YES\r\nxferlog_enable=YES\r\nconnect_from_port_20=YES\r\nxferlog_std_format=YES\r\nlisten=NO\r\nlisten_ipv6=YES\r\npam_service_name=vsftpd\r\nuserlist_enable=YES\r\n<\/pre>\n