本地filezilla&servervsftp搭配使用


环境:本地ubuntu系统&serverubuntu系统

本地安装filezilla 

apt-get install filezilla '安装filezilla
filezilla ‘执行

server安装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

改动该帐户password:

passwd pwftp   ’创建password
123456 ’如果为password

将配置文件里”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 '直接将账户和password放入   

改动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   ‘去除根文件夹的写权限

又一次登录,登录成功,可看到文件。





原文地址:https://www.cnblogs.com/liguangsunls/p/7265762.html