配置虚拟用户(虚拟用户权限根据以下内容控制)
</div>
<span style="font-size:10pt"><span style="font-family:Courier New">mkdir /etc/vsftpd/virtualuser_conf (</span><span style="font-family:等线">虚拟用户配置文件</span><span style="font-family:Courier New">)<br /> </span></span>
<span style="font-size:10pt"><span style="font-family:等线">在</span><span style="font-family:Courier New">/etc/vsftpd/virtualuser_conf </span><span style="font-family:等线">新建一个虚拟用户名文件</span><span style="font-family:Courier New"><br /> </span></span>
<span style="color:#7d8b8d; font-family:Helvetica; font-size:10pt"><span style="background-color:yellow">vim etc/vsftpd/virtualuser_conf /u1(只能下载不能上传)</span><br /> </span>
<span style="font-size:10pt"><span style="font-family:Courier New">local_root=/home/ftp</span><span style="font-family:等线">(该虚拟用户上传下载的根目录)</span><span style="font-family:Courier New"><br /> </span></span>
<span style="font-size:10pt"><span style="font-family:Courier New">write_enable=YES</span><span style="font-family:等线">(启动写权限,上传)</span><span style="font-family:Courier New"><br /> </span></span>
<span style="font-family:Courier New; font-size:10pt">anon_umask=022<br /> </span>
<span style="font-size:10pt"><span style="font-family:Courier New">anon_world_readable_only=NO</span><span style="font-family:等线">(关闭只可读权限)</span><span style="font-family:Courier New"><br /> </span></span>
<span style="font-size:10pt"><span style="font-family:Courier New">anon_upload_enable=NO</span><span style="font-family:等线">(不能上传)</span><span style="font-family:Courier New"><br /> </span></span>
<span style="font-size:10pt"><span style="font-family:Courier New">anon_mkdir_write_enable=YES</span><span style="font-family:等线">(创建目录权限)</span><span style="font-family:Courier New"><br /> </span></span>
<span style="font-size:10pt"><span style="font-family:Courier New">anon_other_write_enable=YES</span><span style="font-family:等线">(其他写权限,改,删)</span><span style="font-family:Courier New"><br /> </span></span>
<p style="background: white">
</p>
<span style="color:#7d8b8d; font-family:Helvetica; font-size:10pt"><span style="background-color:yellow">Vim etc/vsftpd/virtualuser_conf /u2(只能上传,不能下载)</span><br /> </span>
<span style="font-family:Courier New; font-size:10pt">local_root=/home/ftp<br /> </span>
<span style="font-family:Courier New; font-size:10pt">write_enable=YES<br /> </span>
<span style="font-family:Courier New; font-size:10pt">download_enable=NO<br /> </span>
<span style="font-family:Courier New; font-size:10pt">anon_umask=022<br /> </span>
<span style="font-size:10pt"><span style="font-family:Courier New">anon_world_readable_only=NO</span><span style="font-family:等线">(关闭只可读权限)</span><span style="font-family:Courier New"><br /> </span></span>
<span style="font-size:10pt"><span style="font-family:Courier New">anon_upload_enable=YES</span><span style="font-family:等线">(不能上传)</span><span style="font-family:Courier New"><br /> </span></span>
<span style="font-size:10pt"><span style="font-family:Courier New">anon_mkdir_write_enable=YES</span><span style="font-family:等线">(创建目录权限)</span><span style="font-family:Courier New"><br /> </span></span>
<span style="font-size:10pt"><span style="font-family:Courier New">anon_other_write_enable=YES</span><span style="font-family:等线">(其他写权限,改,删)</span><span style="font-family:Courier New"><br /> </span></span>
<span style="font-family:Courier New; font-size:10pt">cmds_allowed=FEAT,REST,CWD,LIST,MDTM,MKD,NLST,PASS,PASV,PORT,PWD,QUIT,RMD,SIZE,STOR,TYPE,USER,ACCT,APPE,CDUP,HELP,MODE,NOOP,REIN,STAT,STOU,STRU,SYST,RETR<br /> </span>
在/etc/vsftpd/目录新建一个虚拟用户文档
</div>
<span style="color:#7d8b8d; font-family:Helvetica; font-size:10pt">vim virtualuser_passwd.txt<br /> </span>
<span style="color:#7d8b8d; font-family:Helvetica"><span style="font-size:10pt">ch</span><span style="color:#333333"><span style="background-color:white">奇数行是用户名,偶数行是密码,</span><span style="color:#7d8b8d; font-size:10pt"><br /> </span></span></span>
生成虚拟用户认证的db文件
</div>
<span style="font-family:Courier New; font-size:10pt">db_load -T -t hash -f /etc/vsftpd/virtualuser_passwd.txt /etc/vsftpd/virtualuser_passwd.db<br /> </span>
编辑认证文件/etc/pam.d/vsftpd,全部注释掉原来语句,添加以下两句
</div>
<span style="font-family:Courier New; font-size:10pt">auth required pam_userdb.so db=/etc/vsftpd/virtualuser_passwd<br /> </span>
<span style="font-family:Courier New; font-size:10pt">account required pam_userdb.so db=/etc/vsftpd/virtualuser_passwd<br /> </span>
设置服务器上的目录权限
</div>
<span style="font-family:Courier New; font-size:10pt">chown -R sprixin:sprixin /home/ftpuser<br /> </span>
<span style="font-family:Courier New; font-size:10pt">chmod 777 /home/ftpuser </span>