filer 发表于 2015-11-6 12:17:57

本地filezilla&服务器vsftp搭配使用

  

环境:本地ubuntu系统&服务器ubuntu系统
  本地安装filezilla

apt-get install filezilla '安装filezilla
filezilla ‘运行
  服务器安装vsftp 参照 阿里云安装vsftp





apt-get install vsftpd -y   ’安装vsftp
  

添加ftp帐号和目录

先检查一下nologin的位置,通常在/usr/sbin/nologin或者/sbin/nologin下。

使用下面的命令创建帐户,该命令指定了/alidata/www/wwwroot为用户pwftp的家目录,您可以自己定义帐户名和目录







useradd -d /alidata/www/wwwroot -s /sbin/nologin test‘添加ftp帐号,加粗为虚拟目录,假设账户为test
  

修改该帐户密码:

passwd pwftp   ’创建密码
123456 ’假设为密码

将配置文件中”anonymous_enable=YES “改为 “anonymous_enable=NO”
取消如下配置前的注释符号:
local_enable=YES
write_enable=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list

保存退出





编辑/etc/vsftpd.chroot_list文件,将ftp的帐户名添加进去,保存退出

vi /etc/vsftpd.chroot_list'此文件默认是没有的,新创建的
test 123456 '直接将账户和密码放入   

修改shell配置,vi编辑/etc/shells,如果该文件里没有/usr/sbin/nologin或者/sbin/nologin(具体看当前系统配置)则追加进去

vi /etc/shells
/usr/sbin/nologin ‘直接添加进去





重启vsftp服务并测试登录



service vsftpd restart
  

本地用filezilla登录ftp,报错



500 OOPS: could not read chroot() list file:/etc/vsftpd.chroot_list
Error:    Critical error
Error:    Could not connect to server</span>
  

解决:



chmod a-w /alidata/www/wwwroot   ‘去除根目录的写权限
  

重新登录,登录成功,可看到文件。






  


  



版权声明:本文为博主原创文章,未经博主允许不得转载。
页: [1]
查看完整版本: 本地filezilla&服务器vsftp搭配使用