vsftpd服务器的安装和配置

您所在的位置:网站首页 简述FTP服务器的安装步骤 vsftpd服务器的安装和配置

vsftpd服务器的安装和配置

2023-11-25 00:32| 来源: 网络整理| 查看: 265

安装FTP服务器

vsftpd(very secure ftp daemon,非常安全的FTP守护进程)是一款运行在Linux操作系统上的FTP服务程序,不仅完全开源而且免费,此外,还具有很高的安全性、传输速度,以及支持虚拟用户验证等其他FTP服务程序不具备的特点,下面开始搭建:

必须使用root用户进入系统。使用命令:rpm –qa | grep vsftpd,查看当前系统是否安装了ftp服务器,安装了vsftpd,就会显示当前的vsftpd的版本信息。

如图:

3.如果安装了需要使用命令:rmp -e vsftpd 卸载当前vsftpd。

如图表示删除成功:

4.在使用命令:rpm –qa | grep vsftpd,查看是否已经删除成功,删除成功则不再显示信息。5.我们使用命令:yum -y install vsftpd 进行安装vsftpd。6.如图安装:

7.这里我们将ftp服务器设置为开启动,

命令是:systemctl enable vsftpd.service。(这里我使用的系统是CentoS7,如果是Centos6的命令为:chkconfig vsftpd on)。

8.启动vsftpd的服务器,

命令:systemctl start vsftpd.service。

9.查看vsftpd的开机启动服务是否生效,

   命令是:systemctl -l | grep vsftpd。

   如图:

10.查看vsftpd的启动状态,命令:systemctl status vsftpd。

   如图:

总结:到这里我们的ftp服务器已经就安装成功,但是我们安装ftp服务器,是用于文件的上传和下载,所以我们需要创建用户和用户对应的上传/下载空间目录。

 

 

 

创建ftp服务器用户和默认目录、

因为ftp服务器的上传和下载都是需要登录,这里我们需要一个匿名的空间,不需要用户的登录,所以我这里主要叙述的匿名登录的设置和修改。

修改etc/vsftpd/vsftpd.conf文件,需要修改如下命令:

修改

# Example config file /etc/vsftpd/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. # # Allow anonymous FTP? (Beware - allowed by default if you comment this out). #是否允许使用匿名登录 anonymous_enable=YES #设置匿名用户的所有根目录 anon_root=/opt/vsftp/anonymous/ # # Uncomment this to allow local users to log in. # When SELinux is enforcing check for SE bool ftp_home_dir 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. # When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access #允许上传文件 anon_upload_enable=YES anon_world_readable_only=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 # # 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/xferlog # # 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. The vsftpd.conf(5) man page explains # the behaviour when these options are disabled. # 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 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 # # When "listen" directive is enabled, vsftpd runs in standalone mode and # listens on IPv4 sockets. This directive cannot be used in conjunction # with the listen_ipv6 directive. #监听端口 listen=YES #监听入站端口号为21 listen_port=21 # # 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. # Make sure, that one of the listen options is commented !! listen_ipv6=YES pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES 这里我们需要关闭ftp服务器的防火墙功能。

到这里我们的ftp匿名服务器就创建完毕,这样我们就能匿名的下载和上传文件。

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3