{"id":1111,"date":"2010-06-08T14:59:00","date_gmt":"2010-06-08T06:59:00","guid":{"rendered":"\/?p=1111"},"modified":"2010-06-08T14:59:00","modified_gmt":"2010-06-08T14:59:00","slug":"1111","status":"publish","type":"post","link":"https:\/\/blog.vimge.com\/archives\/linux\/1111.html","title":{"rendered":"VSFtp\u865a\u62df\u8d26\u53f7\u914d\u7f6e\u4e0e\u7ef4\u62a4"},"content":{"rendered":"

\u5b89\u88c5vsftp\u65f6\u6ca1\u6709db_load\u8fd9\u4e2a\u547d\u4ee4
\u8be5\u547d\u4ee4\u9700\u8981 db4-utils \u7684\u5305
\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u6267\u884c<\/p>\n

<\/span><\/p>\n

\u5373\u53ef\u5b89\u88c5
\u5176\u5b83\u670d\u52a1\u5668\u4e0a\uff0c\u5219\u8981\u5230\u5b89\u88c5\u5149\u76d8\u4e0a\u627e\uff0c\u6216\u8005\u53bb\u7f51\u4e0a\u4e0b\u8f7d<\/p>\n<\/p>\n

\u3000\u3000\u4e3avsftp\u5efa\u7acb\u865a\u62df\u7528\u6237<\/p>\n

\u5728RedHat AS\u91cc\uff0c\u662f\u81ea\u5e26\u4e86vsftpd\u4e3a\u7cfb\u7edf\u63d0\u4f9b\u4e86\u4e00\u4e2aftp\u670d\u52a1\uff0c\u4f46\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\u6839\u636e\u81ea\u5df1\u7684\u9700\u8981\u8fd8\u662f\u8981\u505a\u4e0d\u5c11\u7684\u914d\u7f6e\u3002
\u3000\u3000\u6211\u4eec\u77e5\u9053\uff0c\u5728\u5efa\u7acbvsftpd\u7528\u6237\u65f6\uff0c\u6211\u4eec\u4e00\u822c\u662f\u5728linux\u4e0b\u5efa\u7acb\u7528\u6237useradd\u7684\u65b9\u5f0f\u6765\u8bbf\u95eeftp\uff0c\u4f46\u6709\u65f6\u6211\u4eec\u53ea\u60f3\u63d0\u4f9bftp\u670d\u52a1\uff0c\u800c\u907f\u514d\u7528\u6237\u7528ftp\u7684\u5e10\u53f7\u53bb\u767b\u5f55linux\uff0c\u91c7\u7528\u4e00\u822c\u7684\u65b9\u5f0f\u53ea\u80fd\u662f\u9650\u5236\u8be5\u7528\u6237\u7684\u8bbf\u95ee\u6743\u9650\uff0c\u4f46\u8fd8\u662f\u907f\u514d\u4e0d\u4e86\u7528\u6237\u767b\u5f55\u8fdblinux\u7cfb\u7edf\uff0c\u6240\u4ee5\u6bd4\u8f83\u597d\u7684\u65b9\u6cd5\u662f\u7528vsftpd\u7684\u865a\u62df\u7528\u6237\uff08virtual users\uff09\u3002
\u914d\u7f6e\u7684\u6b65\u9aa4\u5982\u4e0b
\u3000\u3000\uff11\uff09 Create the virtual users database.\uff08\u5efa\u7acb\u865a\u62df\u7528\u6237\u6570\u636e\u5e93\uff09
\u3000\u3000\u5927\u5bb6\u770b\u4e00\u4e0blogins.txt\u6587\u4ef6\u7684\u683c\u5f0f\uff0c\u5b83\u7684\u5185\u5bb9\u662f\uff1a
\u3000\u3000tom
\u3000\u3000foo
\u3000\u3000fred
\u3000\u3000bar
\u3000\u3000\u610f\u601d\u662f\u8bf4\u7528\u6237tom\u7684\u5bc6\u7801\u662ffoo,\u7528\u6237fred\u7684\u5bc6\u7801\u662fbar\uff0c\u8fd9\u5c31\u662f\u865a\u62df\u7528\u6237\u7684\u4fe1\u606f\uff0c\u5927\u5bb6\u53ef\u4ee5\u6309
\u3000\u3000<\u7528\u6237\u540d>
\u3000\u3000<\u5bc6\u3000\u7801>
\u3000\u3000\u7684\u683c\u5f0f\u6765\u5efa\u7acb\u81ea\u5df1\u7684\u865a\u62df\u7528\u6237\u7fa4\u3002
\u3000\u3000\u7136\u540e\u4ee5root\u7528\u6237\u767b\u5f55\u7cfb\u7edf\uff0c\u5efa\u7acb\u7528\u6237\u6570\u636e\u5e93\uff1a
\u3000\u3000db_load -T -t hash -f logins.txt \/etc\/vsftpd_login.db
\u3000\u3000\u8be5\u547d\u4ee4\u4f1a\u5efa\u7acb\u4e00\u4e2a\u6587\u4ef6 \/etc\/vsftpd_login.db ,\u540c\u65f6\u6539\u53d8\u5b83\u7684\u6587\u4ef6\u5c5e\u6027\uff1a
\u3000\u3000chmod 600 \/etc\/vsftpd_login.db
\u3000\u3000\uff12\uff09 Create a PAM file which uses your new database.(\u5efa\u7acbPAM\u6587\u4ef6\uff0c\u544a\u8bc9\u7cfb\u7edf\u4f60\u8981\u4f7f\u7528\u81ea\u5df1\u7684\u6570\u636e\u5e93\u4e86)
\u3000\u3000\u770b\u770b\u53e6\u4e00\u4e2a\u6587\u4ef6vsftpd.pam\uff0c\u5b83\u6709\u4e24\u884c\u5185\u5bb9:
\u3000\u3000auth required \/lib\/security\/pam_userdb.so db=\/etc\/vsftpd_login
\u3000\u3000account required \/lib\/security\/pam_userdb.so db=\/etc\/vsftpd_login
\u3000\u3000\u8fd9\u662f\u544a\u8bc9\u7cfb\u7edf\uff0c\u6211\u5c06\u7528\u65b0\u7684\u7528\u6237\u6388\u6743\u5e93\u4e86\u3002ok\uff0c\u628a\u8fd9\u4e2a\u6587\u4ef6copy\u5230\/etc\/pam.d\/ftp:
\u3000\u3000cp vsftpd.pam \/etc\/pam.d\/ftp
\u3000\u3000\uff13\uff09 Set up the location of the files for the virtual users\uff08\u4e3a\u865a\u62df\u7528\u6237\u5efa\u7acb\u6587\u4ef6\u5939\uff09
\u3000\u3000useradd -d \/home\/ftpsite virtual
\u3000\u3000ls -ld \/home\/ftpsite
\u3000\u3000(\u4f1a\u5f97\u5230\u4ee5\u4e0b\u8f93\u51fa):
\u3000\u3000drwx—— 3 virtual virtual 4096 Jul 30 00:39 \/home\/ftpsite
\u7136\u540e\uff1a
\u3000\u3000cp \/etc\/hosts \/home\/ftpsite
\u3000\u3000chown virtual.virtual \/home\/ftpsite\/hosts
\u3000\u3000\uff14\uff09\u4fee\u6539vsftpd.conf\u6587\u4ef6
\u3000\u3000\u6587\u4ef6\u5728\/etc\/vsftpd\/vsftpd.conf\uff0c\u5728\u540e\u9762\u52a0\u4e0a\uff1a
\u3000\u3000anonymous_enable=NO
\u3000\u3000local_enable=YES
\u3000\u3000write_enable=NO\u3000\uff08\u6ce8\uff1a\u8fd9\u91cc\u53ef\u6309\u9700\u6c42\u8bbe\u7f6e\uff09
\u3000\u3000anon_upload_enable=NO
\u3000\u3000anon_mkdir_write_enable=NO
\u3000\u3000anon_other_write_enable=NO
\u3000\u3000chroot_local_user=YES
\u3000\u3000guest_enable=YES
\u3000\u3000guest_username=virtual
\u3000\u3000user_config_dir=\/etc\/vsftpd_user_conf<\/p>\n

\u3000\u3000\uff15\uff09\u5efa\u7acb\u7528\u6237\u7684\u6743\u9650
\u3000\u3000\u5148mkdir \/etc\/vsftpd_user_conf
\u3000\u3000\/\/\u5f00\u653etom\u548cfred\u7684\u8bfb\u6743\u9650
\u3000\u3000#echo "anon_world_readable_only=NO">\/etc\/vsftpd_user_conf\/tom
\u3000\u3000#echo "anon_world_readable_only=NO">\/etc\/vsftpd_user_conf\/fred
\u8fd9\u6837\u5c31\u53ef\u4ee5\u7528\u8bfb\u6743\u9650\u4e86\uff0c\u80fd\u770b\u5230\u76ee\u5f55\u548c\u6587\u4ef6\u3002
\u3000\u3000\uff16\uff09\u91cd\u542fvsftpd
\u3000\u3000service vsftpd restart
\u3000\u3000ok\uff0c\u7528tom\u7528\u6237\u767b\u5f55ftp\u770b\u770b\uff0c\u662f\u4e0d\u662f\u5df2\u7ecf\u53ef\u4ee5\u4e86<\/p>\n

\u7279\u522b\u6ce8\u610f<\/span>\uff1a
1\u3002\u5982\u679c\u8981\u5220\u9664\u6389\u4e00\u4e2a\u865a\u62df\u7528\u6237\uff0c\u5148\u5728logins.txt\u4e2d\u5220\u9664\u7528\u6237\u5bf9\u5e94\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u7136\u540e\u5220\u9664vsftpd_login.db,\u91cd\u65b0\u8fd0\u884cdb_load -T -t hash -f logins.txt \/etc\/vsftpd_login.db
2\u3002\u5982\u679c\u53ea\u662f\u8981\u4fee\u6539\u7528\u6237\u7684\u5bc6\u7801\uff0c\u53ea\u9700\u91cd\u65b0\u8fd0\u884cdb_load\u5c31\u53ef\u4ee5
3\u3002\u5982\u679c\u8981\u6539\u53d8\u7528\u6237\u7684\u5176\u5b83\u914d\u7f6e\uff0c\u53ea\u9700\u4fee\u6539\u7528\u6237\u7684\u914d\u7f6e\u6587\u4ef6<\/span><\/p>\n

\u539f\u6587\uff1a<\/strong>http:\/\/tristan1.javaeye.com\/blog\/372377<\/span><\/p>\n<\/p>\n

\n
\u5f15\u7528<\/div>\n
rpm -qa|grep db4<\/div>\n<\/div>\n

\u4f1a\u67093\u4e2a\u5305<\/p>\n

\n
\u5f15\u7528<\/div>\n
db4-devel-4.3.29-9.fc6
db4-utils-4.3.29-9.fc6
db4-4.3.29-9.fc6<\/div>\n<\/div>\n

\u5982\u679c\u7f3a\u5c11\uff0c\u5219\u5b89\u88c5\u76f8\u5e94\u7684\u5305\uff0crpm\u5b89\u88c5\u5373\u53ef<\/p>\n

centos\u4e0a\u53ef\u4ee5\u901a\u8fc7<\/p>\n

\n
\u5f15\u7528<\/div>\n
yum install db4-utils<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"

\u5b89\u88c5vsftp\u65f6\u6ca1\u6709db_load\u8fd9\u4e2a\u547d\u4ee4
\u8be5\u547d\u4ee4\u9700\u8981 db4-utils \u7684\u5305
\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u6267\u884c<\/p>\n

<\/span><\/p>\n

\u5373\u53ef\u5b89\u88c5
\u5176\u5b83\u670d\u52a1\u5668\u4e0a\uff0c\u5219\u8981\u5230\u5b89\u88c5\u5149\u76d8\u4e0a\u627e\uff0c\u6216\u8005\u53bb\u7f51\u4e0a\u4e0b\u8f7d<\/p>\n<\/p>\n

\u3000\u3000\u4e3avsftp\u5efa\u7acb\u865a\u62df\u7528\u6237<\/p>\n

\u5728RedHat AS\u91cc\uff0c\u662f\u81ea\u5e26\u4e86vsftpd\u4e3a\u7cfb\u7edf\u63d0\u4f9b\u4e86\u4e00\u4e2aftp\u670d\u52a1\uff0c\u4f46\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\u6839\u636e\u81ea\u5df1\u7684\u9700\u8981\u8fd8\u662f\u8981\u505a\u4e0d\u5c11\u7684\u914d\u7f6e\u3002
\u3000\u3000\u6211\u4eec\u77e5\u9053\uff0c\u5728\u5efa\u7acbvsftpd\u7528\u6237\u65f6\uff0c\u6211\u4eec\u4e00\u822c\u662f\u5728linux\u4e0b\u5efa\u7acb\u7528\u6237useradd\u7684\u65b9\u5f0f\u6765\u8bbf\u95eeftp\uff0c\u4f46\u6709\u65f6\u6211\u4eec\u53ea\u60f3\u63d0\u4f9bftp<\/span><\/p><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1111"}],"collection":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/comments?post=1111"}],"version-history":[{"count":0,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1111\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/media?parent=1111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/categories?post=1111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/tags?post=1111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}