学习在ubuntu系统下安装vsftp软件安装教程

学习在ubuntu系统下安装vsftp软件安装教程

安装vsftpd

bash 复制代码
apt-get install vsftpd

创建用户

创建专用目录

bash 复制代码
 mkdir /home/ftp

添加ftp用户

bash 复制代码
useradd uftp   //  用户名为uftp
passwd uftp    //设置密码

修改目录归属和权限

bash 复制代码
chown utfp:uftp qipa250
chomd 777 -r qipa250(这个也行)

修改配置文件

将上面新建用户添加到里面,一行一个

bash 复制代码
vim /etc/vsftpd.chroot_list

修改vsftpd.conf配置文件

bash 复制代码
vim /etc/vsftpd.conf
bash 复制代码
# 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=NO
#
# 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
#
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=NO
#
# 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)
#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.
anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# If enabled, vsftpd will display directory listings with the time
# in  your  local  time  zone.  The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
ascii_upload_enable=YES
ascii_download_enable=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may restrict local users to their home directories.  See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
chroot_local_user=YES
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty.  Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO

#
# Uncomment this to indicate that vsftpd use a utf8 filesystem.
#utf8_filesystem=YES

#连接ftp服务器使用的端口
listen_port=21
# 设置FTP用户的本地根目录,也就是说,FTP用户登录后,其工作目录将被限制在该目录及其子目录下。
local_root=/data/web
#被动模式的端口范围
pasv_enable=YES
pasv_min_port=1025
pasv_max_port=2025
# 欢迎语
ftpd_banner=Welcome to use my test ftp server

配置文件其他部分详解

bash 复制代码
# 禁止匿名用户登录
anonymous_enable=NO
# 允许系统用户登录
local_enable=YES
# 启用可以修改文件的 FTP 命令
write_enable=YES
# 本地用户创建文件的 umask 值
local_umask=022
# 允许为目录配置显示信息,显示每个目录下面的message_file文件的内容
dirmessage_enable=YES
# 开启日记功能 
xferlog_enable=YES
# 使用标准的20端口来连接ftp 
connect_from_port_20=YES
# 使用标准日志格式 
xferlog_std_format=YES
# ftp服务器将处于独立启动模式
listen=YES
# 设置一个本地用户登录后进入到的目录
local_root=/home/ftp/ftp_mofeng
# 设置PAM认证服务的配置文件名称,该文件保存在"/etc/pam.d/"目录下
pam_service_name=vsftpd
# ftp将检查userlist_file设置文件中指定的用户是否可以访问vsftpd服务器
userlist_enable=YES
# 只允许user_list文件中记录的ftp用户能登录vsftp服务,其他的ftp用户都不可以登录。
userlist_deny=NO
# 定义限制/允许用户登录的文件
userlist_file=/etc/ftpusers
# ftp服务器将使用tcp_wrappers作为主机访问控制模式
tcp_wrappers=YES
# 连接ftp服务器使用的端口
listen_port=21
#( chroot jail是类unix系统中的一种安全机制,用于修改进程运行的根目录环境,限制该线程不能感知到其根目录树以外的其他目录结构和文件的存在。(详情参看chroot jail)。
# 有时我们需要设置根目录(chroot)环境来禁止用户离开他们的家(home)目录。
# 在配置文件中增加/修改下面配置开启根目录限制(Chroot Jail)
#("chroot_list_file"变量指定根目录限制所包含的文件/目录( 即用户只能访问这些文件/目录))
chroot_list_enable=YES 
chroot_list_file= /etc/vsftpd.chroot_list

启动、停止、重启vsftp服务命令

bash 复制代码
# 启动ftp服务
service vsftpd start
# 查看ftp服务状态
service vsftpd status 
# 重启ftp服务
service vsftpd restart
# 关闭ftp服务
service vsftpd stop

使用filezilla.exe

被动模式

相关推荐
oneouto4 分钟前
selenium学习笔记(一)
笔记·学习·selenium
张铁铁是个小胖子13 分钟前
MyBatis学习
java·学习·mybatis
我曾经是个程序员22 分钟前
鸿蒙学习记录之http网络请求
服务器·学习·http
m0_7482323932 分钟前
WebRTC学习二:WebRTC音视频数据采集
学习·音视频·webrtc
真真-真真1 小时前
WebXR
linux·运维·服务器
轩辰~1 小时前
网络协议入门
linux·服务器·开发语言·网络·arm开发·c++·网络协议
虾球xz2 小时前
游戏引擎学习第55天
学习·游戏引擎
雨中rain2 小时前
Linux -- 从抢票逻辑理解线程互斥
linux·运维·c++
oneouto2 小时前
selenium学习笔记(二)
笔记·学习·selenium
sealaugh322 小时前
aws(学习笔记第十九课) 使用ECS和Fargate进行容器开发
笔记·学习·aws