使用VSFTPD搭建FTP服务器

软件安装

apt-get install vsftpd

功能

负责文件的上传和下载

服务端

修改配置文件
vim /etc/vsftpd.conf

修改为下面的样子

# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone?  vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
# 是否允许监听
listen=YES
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
# listen_ipv6=YES
#
anon_root=/home/pim/anonFtp
# Allow anonymous FTP? (Disabled by default).
# 是否允许匿名登录
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
# 是否允许本地用户登录
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
# 实名用户拥有写权限(允许上传数据)
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
# 设置本地掩码为022
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
# 匿名用户可以向ftp服务器上传数据
anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
# 匿名用户可以再ftp服务器创建目录
anon_mkdir_write_enable=YES
重启服务
service vsftpd restart

客户端

实名用户登录
ftp ip(server's ip)
enter username(server's username)
enter password

文件的上传和下载
上传:

put fileName

下载:

get fileName

注意:
ftp服务器不允许操作目录,如有需要需要对目录进行打包

匿名用户登录
ftp ip(server's ip)
enter anonymous
enter ""

上传下载同实名用户
注意:
/home/pim/anonFtp/为其指定操作目录,默认/srv/ftp/
必须为目录提供可写权限,否则匿名用户不能put

lftp客户端访问ftp服务器

vsftpd自带ftp客户端不允许直接上传或下载目录,因此我们可以使用第三方客户端软件

安装:

apt-get install lftp

匿名用户登录:

lftp ip(server's ip)
login

实名用户登录:

lftp username@ip
输入服务器密码

操作:

put 上传文件
mput 上传多个文件
get 下载文件
mget 下载多个文件
mirror 下载整个目录及其字目录
mirror -R 上传整个目录及其字目录
pwd 远程连接所在目录
lpwd 当前客户端所在目录
lcd 当前哭护短所在目录切换

退出

quitbye > exit

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值