{"id":466,"date":"2024-04-11T16:05:56","date_gmt":"2024-04-11T08:05:56","guid":{"rendered":"http:\/\/8.141.4.74\/?p=466"},"modified":"2024-04-11T16:05:56","modified_gmt":"2024-04-11T08:05:56","slug":"ftp%e5%ae%89%e8%a3%85%e6%b5%81%e7%a8%8b","status":"publish","type":"post","link":"http:\/\/8.141.4.74\/?p=466","title":{"rendered":"FTP\u5b89\u88c5\u6d41\u7a0b"},"content":{"rendered":"<h2>vsftpd<\/h2>\n<pre><code class=\"language-bash\"># \u5b89\u88c5vsftpd\ndnf -y install vsftpd\nsystemctl enable --now vsftpd\n\u547d\u4ee4\u7aef\u53e3\u9ed8\u8ba4\u4e3a21\n\u4e3b\u52a8\u6a21\u5f0f\u7aef\u53e3\u4e3a20\n\u88ab\u52a8\u6a21\u5f0f\u7aef\u53e3\u968f\u673a\u5206\u914d\nvim \/etc\/vsftpd\/vsftpd.com\n#\u652f\u6301\u533f\u540d\u7528\u6237\nanonymous_enable=YES\n#\u533f\u540d\u7528\u6237\u7565\u8fc7\u53e3\u4ee4\u68c0\u67e5\nno_anon_password=YES\n#\u533f\u540d\u7528\u6237\u4e0a\u4f20(\u6ce8\u610f\uff1a\u540c\u65f6\u8981\u8bbe\u7f6e\u6587\u4ef6\u7cfb\u7edf\u5199\u6743\u9650\uff0c\u4f46\u662f\u4e0d\u80fd\u7ed9FTP\u6839\u76ee\u5f55\u5199\u6743\u9650\uff0c\u5426\u5219\u62a5\u9519)\nanon_upload_enable=YES\n#\u533f\u540d\u5efa\u76ee\u5f55\nanon_mkdir_write_enable=YES\n\nsetfacl -m u:ftp:rwx \/var\/ftp\/pub<\/code><\/pre>\n<h2>vsftpd\u865a\u62df\u7528\u6237<\/h2>\n<pre><code class=\"language-bash\"># libdb-utils\u662fBerkeley Database\uff08Berkeley DB\uff09\u7684\u4e00\u5957\u5b9e\u7528\u7a0b\u5e8f\u96c6\u5408\u7684\u8f6f\u4ef6\u5305\u540d\u79f0\uff0c\u8fd9\u4e9b\u5b9e\u7528\u7a0b\u5e8f\u7528\u4e8e\u7ba1\u7406\u548c\u64cd\u4f5cBerkeley DB\u6570\u636e\u5e93\u3002Berkeley DB\u662f\u4e00\u4e2a\u4e3a\u5d4c\u5165\u5f0f\u7cfb\u7edf\u8bbe\u8ba1\u7684\u9ad8\u6027\u80fd\u6570\u636e\u5e93\uff0c\u652f\u6301\u591a\u79cd\u6570\u636e\u6a21\u578b\u3002libdb-utils\u901a\u5e38\u5305\u542bdb_load\u7b49\u547d\u4ee4\uff0c\u8fd9\u662f\u521b\u5efa\u548c\u4fee\u6539Berkeley DB\u6570\u636e\u5e93\u6587\u4ef6\u7684\u5de5\u5177\u3002\nyum install libdb-utils\n#\u521b\u5efa\u865a\u62df\u7528\u6237\u5217\u8868\u6587\u4ef6\ncd \/etc\/vsftpd\/\nvim users.txt\n#\u5728\u8be5\u6587\u4ef6\u4e2d\uff0c\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u6bcf\u4e2a\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u5360\u4e00\u884c\uff0c\u683c\u5f0f\u5982\u4e0b\uff1a\u8fd9\u4e2a\u6587\u672c\u6587\u4ef6\u7a0d\u540e\u4f1a\u88ab\u8f6c\u6362\u6210\u6570\u636e\u5e93\u6587\u4ef6\u3002\nxiaoming\n123456\nxiaohong\n123456\nchmod 600 users.txt\n#\u751f\u6210\u865a\u62df\u7528\u6237\u7684\u6570\u636e\u5e93\u6587\u4ef6\ndb_load -T -t hash -f users.txt users.db\n#\u786e\u4fdd\u6570\u636e\u5e93\u6587\u4ef6\u7684\u6743\u9650\u662f\u6b63\u786e\u7684\nchmod 600 users.db\n#\u521b\u5efa\u865a\u62df\u7528\u6237\u6620\u5c04\u7684\u672c\u5730\u7528\u6237\uff08\u521b\u5efa\u4e00\u4e2a\u6ca1\u6709\u767b\u5f55\u6743\u9650\u7684\u7cfb\u7edf\u7528\u6237\uff08vuser\uff09\uff0c\u6240\u6709\u865a\u62dfFTP\u7528\u6237\u7684\u884c\u4e3a\u90fd\u4f1a\u88ab\u6620\u5c04\u5230\u8fd9\u4e2a\u7cfb\u7edf\u7528\u6237\u3002\u8fd9\u610f\u5473\u7740\u865a\u62df\u7528\u6237\u6ca1\u6709\u81ea\u5df1\u7684\u7cfb\u7edf\u7528\u6237\u8d26\u6237\uff0c\u4f46\u5b83\u4eec\u7684\u6240\u6709FTP\u6d3b\u52a8\u90fd\u662f\u4f5c\u4e3avuser\u7528\u6237\u6765\u8fdb\u884c\u7684\u3002\uff09\nuseradd -d \/data\/ftproot -s \/sbin\/nologin -r vuser\n#\u521b\u5efaFTP\u7684\u6839\u76ee\u5f55\u548c\u4e0a\u4f20\u76ee\u5f55\nmkdir -pv \/data\/ftproot\/upload\n#\u8bbe\u7f6e\u9002\u5f53\u7684\u8bbf\u95ee\u63a7\u5236\u5217\u8868\u6743\u9650\uff1a\nsetfacl -m u:vuser:rwx \/data\/ftproot\/upload\/\n#\u521b\u5efaPAM\u914d\u7f6e\u6587\u4ef6\uff1a\u5728PAM\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\u4ee5\u4f7f\u7528db\u6587\u4ef6\u6765\u8ba4\u8bc1\u7528\u6237\uff1bpam_userdb.so\u6a21\u5757\u7528\u4e8e\u8ba9PAM\u901a\u8fc7\u524d\u9762\u521b\u5efa\u7684\u6570\u636e\u5e93\u6587\u4ef6\u6765\u8ba4\u8bc1\u7528\u6237\u3002\nvim \/etc\/pam.d\/vsftpd.db\nauth required pam_userdb.so db=\/etc\/vsftpd\/users\naccount required pam_userdb.so db=\/etc\/vsftpd\/users\n#\u4fee\u6539vsftpd\u7684\u4e3b\u914d\u7f6e\u6587\u4ef6\n#\u7f16\u8f91vsftpd\u914d\u7f6e\u6587\u4ef6\u4ee5\u5f00\u542f\u865a\u62df\u7528\u6237\u529f\u80fd\uff1a\nvim \/etc\/vsftpd\/vsftpd.conf\nguest_enable=YES\nguest_username=vuser\nuser_config_dir=\/etc\/vsftpd\/conf.d\/\nsystemctl restart vsftpd\n#\u521b\u5efa\u865a\u62df\u7528\u6237\u7684\u4e2a\u4eba\u914d\u7f6e\u6587\u4ef6\n#\u5bf9\u4e8e\u6bcf\u4e2a\u865a\u62df\u7528\u6237\uff0c\u521b\u5efa\u5bf9\u5e94\u7684\u914d\u7f6e\u6587\u4ef6\u3002\u8fd9\u6837\uff0c\u6bcf\u4e2a\u865a\u62df\u7528\u6237\u90fd\u53ef\u4ee5\u6709\u4e0d\u540c\u7684\u914d\u7f6e\u3002\nmkdir conf.d\n#\u521b\u5efaxiaoming\u7684\u914d\u7f6e\u6587\u4ef6\nvim conf.d\/xiaoming\n#\u5fc5\u987b\u5173\u95edvsftpd.conf\u91cc\u9762\u8fd9\u4e09\u9879\uff0c\u8981\u4e0d\u7136\u6240\u6709\u7684\u7528\u6237\u90fd\u53ef\u4ee5\u5199\u4e86\n#\u8bbe\u7f6e\u5141\u8bb8\u4e0a\u4f20\u3001\u521b\u5efa\u76ee\u5f55\u7b49\u6743\u9650\uff1a\nanon_upload_enable=YES\nanon_mkdir_write_enable=YES\nanon_other_write_enable=YES\n#\u6307\u5b9a\u8be5\u7528\u6237\u7684FTP\u6839\u76ee\u5f55\uff1a\nlocal_root=\/data\/ftproot1\n#\u521b\u5efaxiaohong\u7684\u4e2a\u4eba\u914d\u7f6e\u6587\u4ef6\nvim conf.d\/xiaohong\nanon_upload_enable=YES\nanon_mkdir_write_enable=YES\nanon_other_write_enable=YES\n#\u6307\u5b9a\u8be5\u7528\u6237\u7684FTP\u6839\u76ee\u5f55\uff1a\nlocal_root=\/data\/ftproot2\nmkdir \/data\/ftproot1\nmkdir \/data\/ftproot2\ntouch \/data\/ftproot1\/1.txt\ntouch \/data\/ftproot2\/2.txt\n#\u5982\u679c\u60f3\u5bf9\u8fd9\u4e24\u4e2a\u865a\u62df\u7528\u6237\u5404\u81ea\u7684\u76ee\u5f55\u8bbe\u7f6e\u4e0d\u540c\u7684\u6743\u9650\nsetfacl -m u:vuser:rwx \/data\/ftproot1\nsetfacl -m u:vuser:rwx \/data\/ftproot2\n#\u60f3\u8981\u5199\uff0c\u5fc5\u987b\u6587\u4ef6\u7cfb\u7edf\u5141\u8bb8\uff0c\u540c\u65f6\u670d\u52a1\u5c42\u9762\u4e5f\u9700\u8981\u5141\u8bb8\uff0c\u5c31\u662fanon_upload\u3001mkdir\u3001other\u8fd9\u4e09\u9879\u3002<\/code><\/pre>\n<h2>\u5b9e\u73b0\u57fa\u4e8eMySQL\u9a8c\u8bc1\u7684vsftpd\u865a\u62df\u7528\u6237<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/typora-images-1307361841.cos.ap-beijing.myqcloud.com\/img\/image-20240402174357180.png\" alt=\"image-20240402174357180\" \/> <\/p>\n<blockquote>\n<p><strong>\u7531\u4e8e\u9ad8\u7248\u672c\u7684CentOS\u3001Rocky Linux\u4e0d\u652f\u6301pam_mysql.so\u6a21\u5757\uff0c\u6240\u4ee5\u7f16\u8bd1\u5b89\u88c5\u5728CentOS 7\u4e0a\u9762\uff1b\u5e76\u4e14\u6570\u636e\u5e93\u4f7f\u7528password()\u51fd\u6570\u5bf9\u660e\u6587\u5bc6\u7801\u52a0\u5bc6\uff0c\u4f46\u662fMySQL 8.0\u4ee5\u4e0a\u7684\u7248\u672c\u5f03\u7528\u4e86\u8be5\u51fd\u6570\uff0c\u6545\u6570\u636e\u5e93\u4f7f\u7528mariadb<\/strong><\/p>\n<p><strong>\u5229\u7528 pam_mysql \u6a21\u5757\u53ef\u4ee5\u5b9e\u73b0\u57fa\u4e8eMySQL\u7684FTP\u865a\u62df\u7528\u6237\u529f\u80fd<\/strong><\/p>\n<\/blockquote>\n<pre><code class=\"language-bash\">\u9879\u76ee\u7f51\u7ad9\uff1a\uff08\u6ce8\u610f:\u56e0\u4e3a\u6b64\u9879\u76ee\u5e74\u4ee3\u4e45\u8fdc\u4e0d\u518d\u66f4\u65b0\uff0c\u5f53\u524d\u53ea\u652f\u6301CentOS 6,7\uff0c\u4e0d\u652f\u6301CentOS 8\u3001Rocky 8\uff09\nhttp:\/\/pam-mysql.sourceforge.net\/\nhttps:\/\/sourceforge.net\/projects\/pam-mysql\/\nhttp:\/\/sf.net\/projects\/pam-mysql<\/code><\/pre>\n<h3>1.\u5728\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0a\u5b89\u88c5mysql\u6570\u636e\u5e93<\/h3>\n<pre><code class=\"language-bash\">#\u6ce8\u610f\uff1aMySQL8.0\u7531\u4e8e\u53d6\u6d88\u4e86PASSWORD()\u51fd\u6570\u4e0d\u652f\u6301,\u56e0\u6b64\u9009\u62e9Mariadb\n[root@Rocky9 ~]# yum info mariadb\nLast metadata expiration check: 1:26:24 ago on Tue 02 Apr 2024 04:25:17 PM CST.\nAvailable Packages\nName         : mariadb\nEpoch        : 3\nVersion      : 10.5.22\nRelease      : 1.el9_2\nArchitecture : x86_64\nSize         : 1.6 M\nSource       : mariadb-10.5.22-1.el9_2.src.rpm\nRepository   : appstream\nSummary      : A very fast and robust SQL database server\nURL          : http:\/\/mariadb.org\nLicense      : GPLv2 and LGPLv2\nDescription  : MariaDB is a community developed fork from MySQL - a multi-user, multi-threaded\n             : SQL database server. It is a client\/server implementation consisting of\n             : a server daemon (mariadbd) and many different client programs and libraries.\n             : The base package contains the standard MariaDB\/MySQL client programs and\n             : utilities.\n\n[root@Rocky9 ~]# yum -y install mariadb-server\n[root@Rocky9 ~]# systemctl enable --now mariadb\nCreated symlink \/etc\/systemd\/system\/mysql.service \u2192 \/usr\/lib\/systemd\/system\/mariadb.service.\nCreated symlink \/etc\/systemd\/system\/mysqld.service \u2192 \/usr\/lib\/systemd\/system\/mariadb.service.\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/mariadb.service \u2192 \/usr\/lib\/systemd\/system\/mariadb.service.\n<\/code><\/pre>\n<h3>2.\u5728\u6570\u636e\u5e93\u670d\u52a1\u4e0a\u914d\u7f6e\u6570\u636e\u5e93\u652f\u6301vsftpd\u670d\u52a1<\/h3>\n<pre><code class=\"language-bash\">#\u5efa\u7acb\u5b58\u50a8\u865a\u62df\u7528\u6237\u6570\u636e\u5e93\u548c\u8868\n[root@centos8 ~]#mysql\nmysql&gt; CREATE DATABASE vsftpd;\nmysql&gt; USE vsftpd;\nmysql&gt; CREATE TABLE users (id INT AUTO_INCREMENT NOT NULL PRIMARY KEY,\nname CHAR(50) BINARY NOT NULL,\npassword CHAR(48) BINARY NOT NULL);\n#\u6dfb\u52a0\u865a\u62df\u7528\u6237\uff0c\u4e3a\u4e86\u5b89\u5168\u5e94\u8be5\u4f7f\u7528PASSWORD\u51fd\u6570\u52a0\u5bc6\u5176\u5bc6\u7801\u540e\u5b58\u50a8\nmysql&gt; INSERT INTO users(name,password) values(&#039;alice&#039;,password(&#039;123456&#039;));\nmysql&gt; INSERT INTO users(name,password) values(&#039;bob&#039;,password(&#039;123456&#039;));\nmysql&gt; select * from users;\n#\u521b\u5efa\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7528\u6237\nmysql&gt; GRANT SELECT ON vsftpd.* TO vsftpd@&#039;10.0.0.%&#039; IDENTIFIED BY &#039;123456&#039;;\nmysql&gt; FLUSH PRIVILEGES; <\/code><\/pre>\n<h3>3.\u5728FTP\u670d\u52a1\u5668\u4e0a\u5b89\u88c5vsftpd \u548c pam_mysql\u5305<\/h3>\n<pre><code class=\"language-bash\">[root@centos7 ~]#yum -y install vsftpd<\/code><\/pre>\n<p>\u6ce8\u610f\uff1a\u5728FTP\u670d\u52a1\u5668\u4e0a\u5b89\u88c5 pam_mysql \u6ce8\u91ca\uff1a\u5bf9\u4e8e centos 6\uff1apam_mysql\u7531EPEL\u7684\u6e90\u4e2d\u63d0\u4f9b<\/p>\n<pre><code class=\"language-bash\">[root@centos6 ~]#yum install pam_mysql<\/code><\/pre>\n<p>\u6ce8\u610f\uff1a\u5bf9\u4e8e centos7 \u548c 8\uff1a\u65e0\u5bf9\u5e94rpm\u5305\uff0c\u9700\u624b\u52a8\u7f16\u8bd1\u5b89\u88c5 \u6ce8\u610f: \u5f53\u524d\u7248\u672c\u7684\u6e90\u7801\u4e0d\u652f\u6301 CentOS 8,\u4f7f\u7528\u4e2d\u4f1a\u63d0\u793a\u4e0b\u9762\u9519\u8bef<\/p>\n<pre><code class=\"language-bash\">[root@centos8 ~]#tail -f \/var\/log\/secure\nJan 2 10:20:31 centos8 vsftpd[15519]: PAM unable to\ndlopen(\/usr\/lib64\/security\/pam_mysql.so): \/usr\/lib64\/security\/pam_mysql.so:\nundefined symbol: make_scrambled_password<\/code><\/pre>\n<h3>4.pam-mysql \u6e90\u7801\u8fdb\u884c\u7f16\u8bd1<\/h3>\n<pre><code class=\"language-bash\">1.\u5b89\u88c5\u76f8\u5173\u5305\n[root@centos7 ~]#yum -y install vsftpd gcc gcc-c++ make mariadb-devel pam-devel\n2.\u4e0b\u8f7dpam-mysql\u6e90\u7801\u8fdb\u884c\u7f16\u8bd1\n[root@centos7 ~]#wget http:\/\/prdownloads.sourceforge.net\/pam-mysql\/pam_mysql-0.7RC1.tar.gz\n#https:\/\/github.com\/NigelCunningham\/pam-MySQL\/archive\/v0.8.1.tar.gz\n3.\u8fdb\u884c\u5305\u7684\u89e3\u538b\n[root@centos7 ~]#tar xvf pam_mysql-0.7RC1.tar.gz\n4.\u8fdb\u5165pam_mysql-0.7RC1\/\u76ee\u5f55\n[root@centos7 ~]#cd pam_mysql-0.7RC1\/\n5.\u521b\u5efa\u914d\u7f6e\u6587\u4ef6\n[root@centos7 pam_mysql-0.7RC1]#.\/configure --with-pam-mods-dir=\/lib64\/security\n#\u5982\u679c\u4e0a\u9762\u547d\u4ee4\u4e0d\u6307\u5b9a --with-pam-mods-dir=\/lib64\/security \u4f1a\u62a5\u4ee5\u4e0b\u9519\u8bef\n#checking if the second argument of pam_conv.conv() takes const pointer... no\nconfigure: error: Your system doesn&#039;t appear to be configured to use PAM.\nPerhaps you need to specify the correct location where the PAM modules reside.\n6.\u7f16\u8bd1\u5b89\u88c5\n[root@centos7 pam_mysql-0.7RC1]#make install\n7.\u67e5\u770b\u6709\u6ca1\u6709\u751f\u6210\u6587\u4ef6\u548c\u6a21\u5757\n[root@centos7 pam_mysql-0.7RC1]#ll \/lib64\/security\/pam_mysql*\n-rwxr-xr-x 1 root root 882 Dec 17 14:34 \/lib64\/security\/pam_mysql.la\n-rwxr-xr-x 1 root root 141712 Dec 17 14:34 \/lib64\/security\/pam_mysql.so\n<\/code><\/pre>\n<h3>5.\u5728FTP\u670d\u52a1\u5668\u4e0a\u5efa\u7acbpam\u8ba4\u8bc1\u6240\u9700\u6587\u4ef6 \uff08\u8fd9\u91cc\u4e00\u5b9a\u8981\u6ce8\u610f\u6570\u636e\u5e93IP\uff09<\/h3>\n<pre><code class=\"language-bash\">[root@centos7 ~]#vi \/etc\/pam.d\/vsftpd.mysql\n#\u6dfb\u52a0\u5982\u4e0b\u4e24\u884c\nauth required pam_mysql.so user=vsftpd passwd=123456 host=10.0.0.137 db=vsftpd table=users usercolumn=name passwdcolumn=password crypt=2\naccount required pam_mysql.so user=vsftpd passwd=123456 host=10.0.0.137 db=vsftpd table=users usercolumn=name passwdcolumn=password crypt=2<\/code><\/pre>\n<h3>6.\u4e0a\u9762\u4e24\u6761\u914d\u7f6e\u7684\u8be6\u89e3<\/h3>\n<p>crypt \u52a0\u5bc6\u65b9\u5f0f\uff1a 0\u8868\u793a\u4e0d\u52a0\u5bc6, 1\u8868\u793acrypt(3)\u52a0\u5bc6, 2\u8868\u793a\u4f7f\u7528mysql password()\u51fd\u6570\u52a0\u5bc6 , 3\u8868\u793amd5\u52a0\u5bc6 , 4\u8868\u793asha1\u52a0\u5bc6<\/p>\n<p>\u914d\u7f6e\u5b57\u6bb5\u8bf4\u660e :<br \/>\n(1) auth \u8868\u793a\u8ba4\u8bc1<br \/>\n(2) account \u9a8c\u8bc1\u8d26\u53f7\u5bc6\u7801\u6b63\u5e38\u4f7f\u7528<br \/>\n(3) required \u8868\u793a\u8ba4\u8bc1\u8981\u901a\u8fc7<br \/>\n(4) pam_mysql.so\u6a21\u5757\u662f\u9ed8\u8ba4\u7684\u76f8\u5bf9\u8def\u5f84\uff0c\u662f\u76f8\u5bf9\/lib64\/security\/\u8def\u5f84\u800c\u8a00\uff0c\u4e5f\u53ef\u4ee5\u5199\u7edd\u5bf9\u8def\u5f84\uff1b\u540e\u9762\u4e3a\u7ed9\u6b64\u6a21\u5757\u4f20\u9012\u7684\u53c2\u6570<br \/>\n(5) user=vsftpd\u4e3a\u767b\u5f55mysql\u7684\u7528\u6237<br \/>\n(6) passwd=123456\u767b\u5f55mysql\u7684\u7684\u5bc6\u7801<br \/>\n(7) host=10.0.0.137mysql\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u6216ip\u5730\u5740<br \/>\n(8) db=vsftpd \u6307\u5b9a\u8fde\u63a5msyql\u7684\u6570\u636e\u5e93\u540d\u79f0<br \/>\n(9) table=users \u6307\u5b9a\u8fde\u63a5\u6570\u636e\u5e93\u4e2d\u7684\u8868\u540d<br \/>\n(10) usercolumn=name \u5f53\u505a\u7528\u6237\u540d\u7684\u5b57\u6bb5<br \/>\n(11) passwdcolumn=password \u5f53\u505a\u7528\u6237\u540d\u5b57\u6bb5\u7684\u5bc6\u7801<br \/>\n(12) crypt=2 \u5bc6\u7801\u7684\u52a0\u5bc6\u65b9\u5f0f\u4e3amysql password()\u51fd\u6570\u52a0\u5bc6<\/p>\n<h3>7.\u5efa\u7acb\u76f8\u5e94\u7528\u6237\u548c\u4fee\u6539vsftpd\u914d\u7f6e\u6587\u4ef6<\/h3>\n<pre><code class=\"language-bash\">#\u5efa\u7acb\u865a\u62df\u7528\u6237\u6620\u5c04\u7684\u7cfb\u7edf\u7528\u6237\u53ca\u5bf9\u5e94\u7684\u76ee\u5f55\n[root@centos7 ~]#useradd -s \/sbin\/nologin -d \/data\/ftproot -r vuser\n#centos7 \u9700\u9664\u53bbftp\u6839\u76ee\u5f55\u7684\u5199\u6743\u9650\n[root@centos7 ~]#mkdir -pv \/data\/ftproot\/upload\n[root@centos7 ~]#setfacl -m u:vuser:rwx \/data\/ftproot\/upload\n#\u786e\u4fdd\/etc\/vsftpd\/vsftpd.conf\u4e2d\u5df2\u7ecf\u542f\u7528\u4e86\u4ee5\u4e0b\u9009\u9879\n[root@centos7 ~]#vim \/etc\/vsftpd\/vsftpd.conf\n#\u6dfb\u52a0\u4e0b\u9762\u4e24\u9879\nguest_enable=YES\nguest_username=vuser\n#\u4fee\u6539\u4e0b\u9762\u4e00\u9879\uff0c\u539f\u7cfb\u7edf\u7528\u6237\u65e0\u6cd5\u767b\u5f55\npam_service_name=vsftpd.mysql\n\u542f\u52a8vsftpd\u670d\u52a1\n[root@centos7 ~]#systemctl enable --now vsftpd \n<\/code><\/pre>\n<h3>8.\u5728FTP\u670d\u52a1\u5668\u4e0a\u914d\u7f6e\u865a\u62df\u7528\u6237\u5177\u6709\u4e0d\u540c\u7684\u8bbf\u95ee\u6743\u9650<\/h3>\n<pre><code class=\"language-bash\">1.\u914d\u7f6evsftpd\u4e3a\u865a\u62df\u7528\u6237\u4f7f\u7528\u914d\u7f6e\u6587\u4ef6\u76ee\u5f55\n[root@centos7 ~]#vim \/etc\/vsftpd\/vsftpd.conf\n#\u6dfb\u52a0\u5982\u4e0b\u9009\u9879\nuser_config_dir=\/etc\/vsftpd\/conf.d\/\n2.\u521b\u5efa\u6240\u9700\u8981\u76ee\u5f55\uff0c\u5e76\u4e3a\u865a\u62df\u7528\u6237\u63d0\u4f9b\u914d\u7f6e\u6587\u4ef6\n[root@centos7 ~]#mkdir \/etc\/vsftpd\/conf.d\/\n#\u914d\u7f6e\u865a\u62df\u7528\u6237\u7684\u8bbf\u95ee\u6743\u9650\n3.\u6ce8\u610f\uff1a\u9700\u786e\u4fdd\u5bf9\u5e94\u7684\u6620\u5c04\u7528\u6237\u5bf9\u4e8e\u6587\u4ef6\u7cfb\u7edf\u6709\u5199\u6743\u9650\n[root@centos7 ~]#vim \/etc\/vsftpd\/conf.d\/alice\nanon_upload_enable={YES|NO}\nanon_mkdir_write_enable={YES|NO}\nanon_other_write_enable={YES|NO}\n4.\u767b\u5f55\u76ee\u5f55\u6539\u53d8\u81f3\u6307\u5b9a\u7684\u76ee\u5f55\nlocal_root=\/data\/ftproot1\n[root@centos7 ~]#vim \/etc\/vsftpd\/conf.d\/bob\nanon_upload_enable={YES|NO}\nanon_mkdir_write_enable={YES|NO}\nanon_other_write_enable={YES|NO}\nlocal_root=\/data\/ftproot2\n5.\u521b\u5efa\u5bf9\u5e94\u7684\u7cfb\u7edf\u76ee\u5f55\u548c\u6388\u6743\u76ee\u5f55\uff08\u6ce8\u610f\u6743\u9650\u95ee\u9898\uff0c\uff09\n[root@centos7 ~]# mkdir -pv \/data\/ftproot1\/upload\n[root@centos7 ~]# mkdir -pv \/data\/ftproot2\/upload \n[root@centos7 ~]# chown vuser:vuser \/data\/ftproot1\/upload\/\n6.\u8fdb\u884c\u6d4b\u8bd5 \n[root@centos8 ~]# ftp 10.0.0.125\n\n#\u5982\u679c\u60f3\u52a0\u65b0\u7528\u6237\uff0c\u53ea\u9700\u8981\u518d\u6570\u636e\u5e93insert\u4e00\u6761\u5373\u53ef<\/code><\/pre>\n<h2>Ubuntu 22.04\u5b89\u88c5vsftpd<\/h2>\n<pre><code class=\"language-bash\"># \u5b89\u88c5ftp\uff0cubuntu\u9ed8\u8ba4\u8def\u5f84\u5728\/srv\/ftp\napt install vsftpd\n#\u7f16\u5199\u914d\u7f6e\u6587\u4ef6\uff0c\u6211\u8fd9\u91cc\u4f7f\u7528\u7cfb\u7edf\u7528\u6237\u767b\u5f55\uff0c\u7981\u6b62ftp\u8fd9\u4e2a\u533f\u540d\u7528\u6237\u767b\u5f55\nvi \/etc\/vsftpd.conf\nanonymous_enable=NO\n#no_anon_password=YES\nlocal_enable=YES\nlocal_root=\/srv\/ftp\nwrite_enable=YES\nanon_upload_enable=YES\nanon_mkdir_write_enable=YES\n#anon_other_write_enable=YES \u5f00\u542f\u8fd9\u9879\u533f\u540d\u7528\u6237\u53ef\u4ee5\u5220\u9664\u6587\u4ef6\n\n#\u65b0\u5efa\u76ee\u5f55\uff0c\u6839\u76ee\u5f55\u4e0d\u80fd\u6709\u5199\u7684\u6743\u9650\nmkdir \/srv\/ftp\/upload\/\nsetfacl -m u:xing:rwx \/srv\/ftp\/upload\/<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>vsftpd # \u5b89\u88c5vsftpd dnf -y install vsftpd systemctl  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68],"tags":[69],"views":255,"_links":{"self":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/466"}],"collection":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=466"}],"version-history":[{"count":1,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/466\/revisions"}],"predecessor-version":[{"id":467,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/466\/revisions\/467"}],"wp:attachment":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=466"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}