打开"终端窗口",输入"sudo apt-get install vsftpd"-->回车-->安装完成。html
打开"终端窗口",输入"sudo service vsftpd restart"重启vsftpd服务-->回车-->vsftpd处于运行状态,说明安装成功。linux
打开"终端窗口",输入"sudo useradd -d /home/workspace/project/Build_FOTA -s /bin/bash ftp"-->回车-->用户新建成功-->输入"sudo passwd ftp"设置ftp用户的密码-->回车-->输入两次密码-->回车-->密码设置成功。 ubuntu
root@chenwr-pc:/home/workspace/project/Build_FOTA# userdel -r ftp
userdel: ftp mail spool (/var/mail/ftp) not found
userdel: /srv/ftp not owned by ftp, not removing
复制代码
首先优先确认防火墙是否关闭。 selinux默认ubuntu不安装,所以使用getenforce来查看当前selinux状态windows
root@chenwr-pc:/etc/selinux# getenforce
Disabled
复制代码
其次肯定windows防火墙是否关闭 浏览器
链接到 172.16.XX.XX。
220 (vsFTPd 3.0.2)
200 Always in UTF8 mode.
ftp> user ftp
331 Please specify the password.
230 Login successful.
ftp>
ftp> put 1.zip /home/workspace/project/Build_FOTA/EC20-delta-gentools/v1/targetfiles.zip
200 PORT command successful. Consider using PASV.
550 Permission denied.
复制代码
提示没有权限,修改配置文件便可。 上传 功能# Uncomment this to enable any form of FTP write command. write_enable=YES(开启就行了) sudo service vsftpd restart重启服务就ok安全
原先目录存在同名文件,上传文件提示没法建立文件,此时只须要修改目录权限便可。bash
200 PORT command successful. Consider using PASV.
553 Could not create file.
复制代码
修改FTP服务器指定目录的权限便可 chmod 777 -R EC20-delta-gentools/服务器
(1)输入"sudo gedit /etc/ftpusers",该文件记录不能访问FTP服务器的用户清单 网络
(2)本身新建文件存储ftp用户名来容许访问的方式。app
root@chenwr-pc:/etc# vi cwr_allow_users
复制代码
并添加ftp ftp1 ftp2 本身测试添加的用户名,进行测试。 修改 /etc/vsftpd.conf配置文件,添加
详细说明:
配置 vsftpd.conf
第一步,配置userlist_deny
第二步,userlist_enable=YES 启用了用户列表。
第三步,配置用户列表,userlist_file=/etc/cwr_allow_users (cwr_allow_users这个文件本身新建的,随意怎么命名均可以)
root@chenwr-pc:/etc# cat cwr_allow_users
ftp
ftp1
ftp2
复制代码
sudo apt-get remove vsftpd --purge
root@chenwr-pc:~# sudo apt-get remove vsftpd --purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
vsftpd*
0 upgraded, 0 newly installed, 1 to remove and 750 not upgraded.
After this operation, 361 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 185238 files and directories currently installed.)
Removing vsftpd (3.0.2-1ubuntu2.14.04.1) ...
vsftpd stop/waiting
Purging configuration files for vsftpd (3.0.2-1ubuntu2.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1) ...
复制代码
配置选项说明
anonymous_enable=NO # 关闭匿名登陆
local_enable=YES # 容许本地用户登陆
write_enable=YES # 启用能够修改文件的 FTP 命令
local_umask=022 # 本地用户建立文件的 umask 值
dirmessage_enable=YES # 当用户第一次进入新目录时显示提示消息
xferlog_enable=YES # 一个存有详细的上传和下载信息的日志文件
connect_from_port_20=YES # 在服务器上针对 PORT 类型的链接使用端口 20(FTP 数据)
xferlog_std_format=YES # 保持标准日志文件格式
listen=NO # 阻止 vsftpd 在独立模式下运行
listen_ipv6=YES # vsftpd 将监听 ipv6 而不是 IPv4,你能够根据你的网络状况设置
pam_service_name=vsftpd # vsftpd 将使用的 PAM 验证设备的名字
userlist_enable=YES # 容许 vsftpd 加载用户名字列表
tcp_wrappers=YES # 打开 tcp 包装器
chroot_local_user=YES # 选项chroot_local_user=YES 意味着本地用户将进入 chroot 环境,当登陆之后默认状况下是其 home 目录。
allow_writeable_chroot=YES # 默认状况下,出于安全缘由,VSFTPD 不容许 chroot 目录具备可写权限。设置为YES为开启写权限。
复制代码
参考资料: ubuntu 下的ftp详细配置 - 何惜戈 - 博客园 www.cnblogs.com/hexige/p/78…
树莓派FTP文件传输小记 - 兴国的博客 - CSDN博客 blog.csdn.net/cyzyfs/arti…